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

Menu   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 18
dl 0
loc 72
ccs 16
cts 18
cp 0.8889
c 1
b 0
f 1
rs 10
wmc 10

19 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ translate() 0 2 1
__construct() 0 7 ?
A hp$0 ➔ __construct() 0 7 1
setTranslator() 0 2 ?
A hp$0 ➔ getHtmlId() 0 2 1
setTitle() 0 2 ?
A hp$0 ➔ setTitle() 0 2 1
getName() 0 2 ?
getTitle() 0 2 ?
getTranslator() 0 2 ?
A hp$0 ➔ getTitle() 0 2 1
getHtmlId() 0 2 ?
setName() 0 2 ?
A hp$0 ➔ getName() 0 2 1
A hp$0 ➔ setTranslator() 0 2 1
setHtmlId() 0 2 ?
A hp$0 ➔ setName() 0 2 1
A hp$0 ➔ setHtmlId() 0 2 1
A hp$0 ➔ getTranslator() 0 2 1
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
?>