| Conditions | 6 |
| Paths | 8 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function traverse(ControlFlowGraph $cfg) |
||
| 23 | { |
||
| 24 | $rootBlock = $cfg->getRoot(); |
||
| 25 | |||
| 26 | /** @var AbstractVisitor $visitor */ |
||
| 27 | foreach ($this->visitors as $visitor) { |
||
| 28 | $visitor->enterBlock($rootBlock); |
||
| 29 | } |
||
| 30 | |||
| 31 | $childrens = $rootBlock->getChildrens(); |
||
| 32 | if ($childrens) { |
||
|
|
|||
| 33 | foreach ($childrens as $children) { |
||
| 34 | foreach ($this->visitors as $visitor) { |
||
| 35 | $visitor->enterNode($children); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | /** @var AbstractVisitor $visitor */ |
||
| 41 | foreach ($this->visitors as $visitor) { |
||
| 42 | $visitor->leaveBlock($rootBlock); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
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.