Completed
Push — master ( 9ef627...4efa22 )
by Jakub
05:41
created

Menu   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 44.44%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 68
ccs 8
cts 18
cp 0.4444
rs 10
c 1
b 0
f 1
eloc 18
wmc 10

19 Methods

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