forked from mage-os-nl/mage-os.nl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuItem.php
More file actions
41 lines (35 loc) · 818 Bytes
/
MenuItem.php
File metadata and controls
41 lines (35 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php declare(strict_types=1);
namespace MageOsNl\Website;
class MenuItem {
public function __construct(
private string $label,
private string $url,
private string $class = 'block py-1 hover:text-orange transition-colors text-center'
) {
}
/**
* @return string
*/
public function getLabel(): string
{
return __($this->label);
}
/**
* @return string
*/
public function getUrl(): string
{
return (new Url($this->url))->getUrl();
}
/**
* @return string
*/
public function getClass(): string
{
$class = $this->class;
if ($_SERVER['REQUEST_URI'] == $this->url) {
$class = ' border-b-orange border-b-2 mt-1 inline-block';
}
return $class;
}
}