| Conditions | 6 |
| Paths | 8 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 20 | public function fireChanges() |
||
| 21 | { |
||
| 22 | if($this->spy->hasChanges()) { |
||
| 23 | // reduce changes list |
||
| 24 | $changes = $this->spy->getChanges(); |
||
| 25 | foreach($changes as $action => $collection) { |
||
| 26 | foreach($collection as $space => $entities) { |
||
| 27 | |||
| 28 | $event = $this->service->getName().'.'.$space.'.'.$action; |
||
| 29 | |||
| 30 | if(!$this->service->eventExists($event)) { |
||
| 31 | unset($collection[$space]); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | if(!count($collection)) { |
||
| 35 | unset($changes[$action]); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | $this->dispatcher->dispatch('event.changes', [ |
||
| 40 | 'changes' => $spy->getChanges(), |
||
|
|
|||
| 41 | 'service' => $this->service, |
||
| 42 | ]); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.