| Conditions | 3 |
| Paths | 4 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 75 | 6 | public function getPageByName(string $name): string |
|
| 76 | { |
||
| 77 | 6 | if (!$this->resolvedArray) { |
|
|
|
|||
| 78 | 6 | $this->resolveArray(); |
|
| 79 | } |
||
| 80 | 6 | if (!isset($this->resolvedArray[ $name ])) { |
|
| 81 | 2 | throw new \Exception("Index page [{$name}] not exists"); |
|
| 82 | } |
||
| 83 | |||
| 84 | 6 | return $this->resolvedArray[ $name ]; |
|
| 85 | } |
||
| 105 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.