| Conditions | 5 |
| Paths | 9 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 2 | private function render(Section $section): string |
|
| 36 | { |
||
| 37 | 2 | $name = $section->section; |
|
| 38 | 2 | if ('global' !== $section->section) { |
|
| 39 | 2 | $name .= $section->suffix ? ' ' . $section->suffix : ''; |
|
| 40 | } |
||
| 41 | |||
| 42 | 2 | $result = "[$name]" . PHP_EOL; |
|
| 43 | 2 | foreach ($section->parameters as $key => $val) { |
|
| 44 | 2 | $result .= "$key = " . (is_numeric($val) ? $val : '"' . $val . '"') . PHP_EOL; |
|
| 45 | } |
||
| 46 | |||
| 47 | 2 | return $result . PHP_EOL; |
|
| 48 | } |
||
| 49 | |||
| 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: