Create an insecure bank application
This commit is contained in:
24
webroot/lib/Model/NavigationEntry.php
Normal file
24
webroot/lib/Model/NavigationEntry.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Model;
|
||||
|
||||
class NavigationEntry
|
||||
{
|
||||
public function __construct(
|
||||
public string $displayText,
|
||||
public string $url,
|
||||
) {
|
||||
}
|
||||
|
||||
public function send(Context $context): void
|
||||
{
|
||||
$displayText = htmlspecialchars($this->displayText);
|
||||
$url = htmlspecialchars($this->url);
|
||||
if ($this->url === $context->currentPage) {
|
||||
echo "<li aria-current=\"page\"><span>{$displayText}</span></li>";
|
||||
} else {
|
||||
echo "<li><a href=\"{$url}\">{$displayText}</a></li>";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user