Passed
Push — master ( a7342a...509034 )
by Jakub
01:53
created

Menu::getAllowedItems()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 0
crap 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Menu;
5
6
use Nette\Localization\ITranslator;
7
8
/**
9
 * Menu
10
 *
11
 * @author Jakub Konečný
12
 * @property string $title
13
 * @property-read string $name
14
 * @property string $htmlId
15
 * @property ITranslator $translator
16
 */
17 1
class Menu extends Collection {
18 1
  use \Nette\SmartObject;
19
  
20
  /** @var string */
21
  protected $title = "";
22
  /** @var string */
23
  protected $name;
24
  /** @var string*/
25
  protected $htmlId;
26
  /** @var ITranslator */
27
  protected $translator;
28
  
29
  public function __construct(string $name = "default", string $htmlId = "menu") {
30 1
    $this->name = $name;
31 1
    $this->htmlId = $htmlId;
32 1
    $this->translator = new class implements ITranslator {
33
      public function translate($message, $count = NULL): string {
34 1
        return $message;
35
      }
36
    };
37 1
  }
38
  
39
  public function getTitle(): string {
40 1
    return $this->title;
41
  }
42
  
43
  public function setTitle(string $title) {
44 1
    $this->title = $title;
45 1
  }
46
  
47
  public function getName(): string {
48 1
    return $this->name;
49
  }
50
  
51
  public function getHtmlId(): string {
52 1
    return $this->htmlId;
53
  }
54
  
55
  public function setHtmlId(string $htmlId) {
56 1
    $this->htmlId = $htmlId;
57 1
  }
58
  
59
  public function getTranslator(): ITranslator {
60 1
    return $this->translator;
61
  }
62
  
63
  public function setTranslator(ITranslator $translator) {
64 1
    $this->translator = $translator;
65 1
  }
66
}
67
?>