Total Complexity | 7 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 60% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | abstract class AbstractHandler implements ResponseHandlerInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $configuration = []; |
||
13 | |||
14 | abstract public function getName(): string; |
||
15 | |||
16 | /** |
||
17 | * ResponseCodeHandler constructor. |
||
18 | */ |
||
19 | 6 | public function __construct(array $configuration = []) |
|
20 | { |
||
21 | 6 | $this->configuration = $configuration; |
|
22 | 6 | } |
|
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | 1 | public function supports(string $routeName): bool |
|
28 | { |
||
29 | 1 | if (!key_exists($routeName, $this->configuration)) { |
|
30 | 1 | return false; |
|
31 | } |
||
32 | |||
33 | 1 | if (!key_exists('handlers', $this->configuration[$routeName])) { |
|
34 | 1 | return false; |
|
35 | } |
||
36 | |||
37 | 1 | return key_exists($this->getName(), $this->configuration[$routeName]['handlers']); |
|
38 | } |
||
39 | |||
40 | protected function getConfiguration(string $routeName): array |
||
43 | } |
||
44 | |||
45 | protected function getMappingName(string $routeName): ?string |
||
54 |