Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
56 | 3 | public function generate(): string |
|
57 | { |
||
58 | 3 | if (!$this->config instanceof ConfigInterface) { |
|
59 | 1 | throw new RuntimeException('Provided config is invalid'); |
|
60 | } |
||
61 | |||
62 | 2 | $result = ''; |
|
63 | 2 | foreach ($this->config->sections as $section) { |
|
|
|||
64 | 2 | $result .= $this->render($section); |
|
65 | } |
||
66 | |||
67 | 2 | return $result; |
|
68 | } |
||
69 | } |
||
70 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: