| Conditions | 7 |
| Paths | 15 |
| Total Lines | 28 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 4 | ||
| 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 | $event = $this->service->getName().'.'.$space.'.'.$action; |
||
| 28 | |||
| 29 | if (!$this->service->eventExists($event)) { |
||
| 30 | unset($collection[$space]); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | if (!count($collection)) { |
||
| 34 | unset($changes->$action); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | if (count($changes)) { |
||
| 39 | $this->dispatcher->dispatch('event.changes', [ |
||
| 40 | 'changes' => $changes, |
||
| 41 | 'service' => $this->service->getName(), |
||
| 42 | ]); |
||
| 43 | } |
||
| 44 | |||
| 45 | $this->spy->reset(); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 |