Passed
Push — master ( 1f2740...7dbefe )
by Jakub
01:40
created

Menu.php$0 ➔ setName()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 2
ccs 0
cts 1
cp 0
c 0
b 0
f 0
cc 1
crap 2
rs 10
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 string $name
14
 * @property string $htmlId
15
 * @property ITranslator $translator
16
 */
17 1
class Menu extends Collection {
18
  /** @var string */
19
  protected $title = "";
20
  /** @var string */
21
  protected $name;
22
  /** @var string */
23
  protected $htmlId;
24
  /** @var ITranslator */
25
  protected $translator;
26
  
27
  public function __construct(string $name = "default", string $htmlId = "menu") {
28 1
    parent::__construct();
29 1
    $this->name = $name;
30 1
    $this->htmlId = $htmlId;
31 1
    $this->translator = new class implements ITranslator {
32
      public function translate($message, ... $parameters): string {
1 ignored issue
show
introduced by
The method parameter $parameters is never used
Loading history...
33 1
        return $message;
34
      }
35
    };
36 1
  }
37
38
  /**
39
   * @deprecated Access the property directly
40
   */
41
  public function getTitle(): string {
42 1
    return $this->title;
43
  }
44
45
  /**
46
   * @deprecated Access the property directly
47
   */
48
  public function setTitle(string $title): void {
49 1
    $this->title = $title;
50 1
  }
51
52
  /**
53
   * @deprecated Access the property directly
54
   */
55
  public function getName(): string {
56 1
    return $this->name;
57
  }
58
59
  protected function setName(string $name): void {
60
    $this->name = $name;
61
  }
62
63
  /**
64
   * @deprecated Access the property directly
65
   */
66
  public function getHtmlId(): string {
67 1
    return $this->htmlId;
68
  }
69
70
  /**
71
   * @deprecated Access the property directly
72
   */
73
  public function setHtmlId(string $htmlId): void {
74 1
    $this->htmlId = $htmlId;
75 1
  }
76
77
  /**
78
   * @deprecated Access the property directly
79
   */
80
  public function getTranslator(): ITranslator {
81 1
    return $this->translator;
82
  }
83
84
  /**
85
   * @deprecated Access the property directly
86
   */
87
  public function setTranslator(ITranslator $translator): void {
88 1
    $this->translator = $translator;
89 1
  }
90
}
91
?>