Total Complexity | 7 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 31.25% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class TextView implements View |
||
11 | { |
||
12 | private string $name; |
||
13 | private array $options; |
||
14 | private ?\Closure $dataTransformer; |
||
15 | |||
16 | public function __construct(string $name, array $options = [], ?\Closure $dataTransformer = null) |
||
17 | 1 | { |
|
18 | $this->name = $name; |
||
19 | 1 | $this->options = $options; |
|
20 | 1 | $this->dataTransformer = $dataTransformer; |
|
21 | 1 | } |
|
22 | 1 | ||
23 | public function getName(): string |
||
24 | { |
||
25 | return $this->name; |
||
26 | } |
||
27 | |||
28 | public function getOptions(): array |
||
31 | } |
||
32 | |||
33 | public function getOption(string $name) |
||
34 | { |
||
35 | if (!\array_key_exists($name, $this->options)) { |
||
36 | throw new Exception('Invalid option "'.$name.'" for field "'.$this->getName().'"'); |
||
37 | } |
||
38 | |||
39 | return $this->options[$name]; |
||
40 | } |
||
41 | |||
42 | public function getTemplate(): string |
||
45 | } |
||
46 | |||
47 | public function getDataTransformer(): ?\Closure |
||
50 | } |
||
51 | } |
||
52 |