@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @return $this |
| 54 | 54 | */ |
| 55 | 55 | public function on($event, $fn) { |
| 56 | - if(!array_key_exists($event, $this->listeners)) { |
|
| 56 | + if (!array_key_exists($event, $this->listeners)) { |
|
| 57 | 57 | $this->listeners[$event] = array(); |
| 58 | 58 | } |
| 59 | 59 | $this->listeners[$event][] = $fn; |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | public function run() { |
| 68 | 68 | $services = $this->attributeRepository->fetchServices(); |
| 69 | 69 | $count = 0; |
| 70 | - foreach($services as $service) { |
|
| 71 | - if(!array_key_exists($service, $this->services)) { |
|
| 70 | + foreach ($services as $service) { |
|
| 71 | + if (!array_key_exists($service, $this->services)) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | - if(array_key_exists($service, $this->standardTimeouts)) { |
|
| 74 | + if (array_key_exists($service, $this->standardTimeouts)) { |
|
| 75 | 75 | $standardTimeout = $this->standardTimeouts[$service]; |
| 76 | 76 | } else { |
| 77 | 77 | $standardTimeout = 0; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | try { |
| 84 | 84 | $this->fireEvent('service-start', $eventParams); |
| 85 | 85 | $this->attributeRepository->markTry($service); |
| 86 | - if($this->methodInvoker !== null) { |
|
| 86 | + if ($this->methodInvoker !== null) { |
|
| 87 | 87 | $this->methodInvoker->invoke($this->services[$service], $eventParams); |
| 88 | 88 | } else { |
| 89 | 89 | call_user_func($this->services[$service], $service); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } catch (\Exception $e) { |
| 95 | 95 | $eventParams['exception'] = $e; |
| 96 | 96 | $this->fireEvent('service-failure', $eventParams); |
| 97 | - if($this->logger !== null) { |
|
| 97 | + if ($this->logger !== null) { |
|
| 98 | 98 | $this->logger->critical("{$service}: {$e->getMessage()}", array('exception' => $e)); |
| 99 | 99 | } else { |
| 100 | 100 | throw new Exception("{$service}: {$e->getMessage()}", (int) $e->getCode(), $e); |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | * @param array $params |
| 110 | 110 | */ |
| 111 | 111 | private function fireEvent($event, $params) { |
| 112 | - if(array_key_exists($event, $this->listeners)) { |
|
| 112 | + if (array_key_exists($event, $this->listeners)) { |
|
| 113 | 113 | try { |
| 114 | - foreach($this->listeners[$event] as $listener) { |
|
| 114 | + foreach ($this->listeners[$event] as $listener) { |
|
| 115 | 115 | $this->methodInvoker->invoke($listener, $params); |
| 116 | 116 | } |
| 117 | 117 | } catch (Exception $e) { |
| 118 | 118 | // Supress exceptions emitted by events |
| 119 | - if($this->logger !== null) { |
|
| 119 | + if ($this->logger !== null) { |
|
| 120 | 120 | $this->logger->critical($e->getMessage(), array('exception' => $e)); |
| 121 | 121 | } |
| 122 | 122 | } |