| Conditions | 7 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 4 | public function fire($action, $args) |
|
| 25 | { |
||
| 26 | 4 | $this->value = isset($args[0]) ? $args[0] : ''; |
|
| 27 | |||
| 28 | 4 | if ($this->getListeners()) { |
|
| 29 | 4 | $listeners = $this->getListeners(); |
|
| 30 | |||
| 31 | 4 | foreach ($listeners as $listener) { |
|
| 32 | 4 | if ($listener['hook'] == $action) { |
|
| 33 | 4 | $parameters = []; |
|
| 34 | 4 | $args[0] = $this->value; |
|
| 35 | |||
| 36 | 4 | for ($i = 0; $i < $listener['arguments']; $i++) { |
|
| 37 | 4 | if (isset($args[$i])) { |
|
| 38 | 4 | $parameters[] = $args[$i]; |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | 4 | $this->value = call_user_func_array($this->getFunction($listener['callback']), $parameters); |
|
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 3 | return $this->value; |
|
| 48 | } |
||
| 50 |