| Total Complexity | 11 |
| Total Lines | 124 |
| Duplicated Lines | 0 % |
| Coverage | 82.76% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class Link |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | protected $module; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $controller; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $acl; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var array |
||
| 39 | */ |
||
| 40 | protected $fields = []; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Constructor of Link |
||
| 44 | * |
||
| 45 | * @param string $module |
||
| 46 | * @param string $controller |
||
| 47 | */ |
||
| 48 | 24 | public function __construct(string $module, string $controller) |
|
| 49 | { |
||
| 50 | 24 | $this->setModule($module); |
|
| 51 | 24 | $this->setController($controller); |
|
| 52 | 24 | } |
|
| 53 | |||
| 54 | /** |
||
| 55 | * Set ACL privilege |
||
| 56 | * |
||
| 57 | * @param string $acl |
||
| 58 | * |
||
| 59 | * @return Link |
||
| 60 | */ |
||
| 61 | 2 | public function acl(string $acl): Link |
|
| 62 | { |
||
| 63 | 2 | $this->setAcl($acl); |
|
| 64 | 2 | return $this; |
|
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Set filters for data |
||
| 69 | * |
||
| 70 | * @param array $fields |
||
| 71 | * |
||
| 72 | * @return Link |
||
| 73 | */ |
||
| 74 | public function fields(array $fields): Link |
||
| 75 | { |
||
| 76 | $this->setFields($fields); |
||
| 77 | return $this; |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @return string |
||
| 82 | */ |
||
| 83 | 22 | public function getModule(): ?string |
|
| 84 | { |
||
| 85 | 22 | return $this->module; |
|
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @param string $module |
||
| 90 | */ |
||
| 91 | 24 | protected function setModule(string $module): void |
|
| 92 | { |
||
| 93 | 24 | $this->module = $module; |
|
| 94 | 24 | } |
|
| 95 | |||
| 96 | /** |
||
| 97 | * @return string |
||
| 98 | */ |
||
| 99 | 22 | public function getController(): ?string |
|
| 100 | { |
||
| 101 | 22 | return $this->controller; |
|
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @param string $controller |
||
| 106 | */ |
||
| 107 | 24 | protected function setController(string $controller): void |
|
| 108 | { |
||
| 109 | 24 | $this->controller = $controller; |
|
| 110 | 24 | } |
|
| 111 | |||
| 112 | /** |
||
| 113 | * @return string|null |
||
| 114 | */ |
||
| 115 | 24 | public function getAcl(): ?string |
|
| 118 | } |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @param string $acl |
||
| 122 | */ |
||
| 123 | 2 | protected function setAcl(string $acl): void |
|
| 126 | 2 | } |
|
| 127 | |||
| 128 | /** |
||
| 129 | * @return array |
||
| 130 | */ |
||
| 131 | 22 | public function getFields(): array |
|
| 134 | } |
||
| 135 | |||
| 136 | /** |
||
| 137 | * Setup data filters |
||
| 138 | * |
||
| 139 | * @param array $fields |
||
| 140 | */ |
||
| 141 | protected function setFields(array $fields): void |
||
| 144 | } |
||
| 145 | } |
||
| 146 |