@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -}else {
|
|
| 60 | +} else {
|
|
| 61 | 61 | throw new RuntimeException('Could not get CafeGateway');
|
| 62 | 62 | } |
| 63 | 63 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $listners = $this->doGetListeners(); |
| 105 | 105 | if (!$this->hadListeners($name, $object)) { |
| 106 | 106 | $res = false; |
| 107 | - }else { |
|
| 107 | + } else { |
|
| 108 | 108 | $listners = $this->doGetListeners(); |
| 109 | 109 | $res = (boolean)count($listners[$object][$name]); |
| 110 | 110 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | foreach($listeners as $listener){ |
| 212 | 212 | if($listener instanceof \PEIP\INF\Handler\Handler){ |
| 213 | 213 | $listener->handle($subject); |
| 214 | - }elseif(is_callable($listener)){ |
|
| 214 | + } elseif(is_callable($listener)){ |
|
| 215 | 215 | call_user_func($listener, $subject); |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -43,18 +43,18 @@ |
||
| 43 | 43 | } |
| 44 | 44 | } //put your code here |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Creates an event-object with given object as content/subject and notifies |
|
| 48 | - * all registers listeners of the event. |
|
| 49 | - * |
|
| 50 | - * @access public |
|
| 51 | - * @param string $name name of the event |
|
| 52 | - * @param object $object the subject of the event |
|
| 53 | - * @param array $headers headers of the event-object as key/value pairs |
|
| 54 | - * @param string $eventClass event-class to create instances from |
|
| 55 | - * @return |
|
| 46 | + /** |
|
| 47 | + * Creates an event-object with given object as content/subject and notifies |
|
| 48 | + * all registers listeners of the event. |
|
| 49 | + * |
|
| 50 | + * @access public |
|
| 51 | + * @param string $name name of the event |
|
| 52 | + * @param object $object the subject of the event |
|
| 53 | + * @param array $headers headers of the event-object as key/value pairs |
|
| 54 | + * @param string $eventClass event-class to create instances from |
|
| 55 | + * @return |
|
| 56 | 56 | boolean|null @see EventBuilder |
| 57 | - */ |
|
| 57 | + */ |
|
| 58 | 58 | public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
| 59 | 59 | if (!$this->hasListeners($name, ($object))) { |
| 60 | 60 | return false; |
@@ -46,10 +46,10 @@ |
||
| 46 | 46 | if ($this->hasListeners($name, $object->getContent())) { |
| 47 | 47 | return self::doNotify($this->getListeners($name, $object->getContent()), $object); |
| 48 | 48 | } |
| 49 | - }else { |
|
| 49 | + } else { |
|
| 50 | 50 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
| 51 | 51 | } |
| 52 | - }else { |
|
| 52 | + } else { |
|
| 53 | 53 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $name = is_object($name) ? get_class($name) : (string)$name; |
| 23 | 23 | if (Test::assertClassOrInterfaceExists($name)) { |
| 24 | 24 | parent::connect($name, $listener); |
| 25 | - }else { |
|
| 25 | + } else { |
|
| 26 | 26 | throw new \InvalidArgumentException($name." is not an Class nor Interface"); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -134,12 +134,10 @@ |
||
| 134 | 134 | $res = false; |
| 135 | 135 | try { |
| 136 | 136 | $res = (string)$this->getContent(); |
| 137 | - } |
|
| 138 | - catch (\Exception $e) { |
|
| 137 | + } catch (\Exception $e) { |
|
| 139 | 138 | try { |
| 140 | 139 | $res = get_class($this->getContent()); |
| 141 | - } |
|
| 142 | - catch (\Exception $e) { |
|
| 140 | + } catch (\Exception $e) { |
|
| 143 | 141 | return ""; |
| 144 | 142 | } |
| 145 | 143 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | public function execute() { |
| 55 | 55 | if (is_callable($this->getContent())) { |
| 56 | 56 | return call_user_func($this->getContent()); |
| 57 | - }else { |
|
| 57 | + } else { |
|
| 58 | 58 | return $this->getContent()->execute(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | if ($static && !$reflectionFunc->isStatic()) { |
| 57 | 57 | throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not an Callable: Method "'.$method.'" of class '.$class.' is not static.'); |
| 58 | 58 | } |
| 59 | - }else { |
|
| 59 | + } else { |
|
| 60 | 60 | $reflectionFunc = new \ReflectionFunction($this->callable); |
| 61 | 61 | } |
| 62 | 62 | $this->requiredParameters = $reflectionFunc->getNumberOfRequiredParameters(); |
| 63 | - }else { |
|
| 63 | + } else { |
|
| 64 | 64 | throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not a Callable'); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -79,8 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | try { |
| 81 | 81 | return call_user_func_array($this->callable, array($message, $channel, $sent)); |
| 82 | - } |
|
| 83 | - catch (\Exception $e) { |
|
| 82 | + } catch (\Exception $e) { |
|
| 84 | 83 | throw new \RuntimeException('Unable to call Callable: '.$e->getMessage()); |
| 85 | 84 | } |
| 86 | 85 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | if ($this->hasService($key)) { |
| 119 | 119 | $service = $this->getService($key); |
| 120 | - }else { |
|
| 120 | + } else { |
|
| 121 | 121 | $service = $this->createService($key); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | )); |
| 150 | 150 | |
| 151 | 151 | return $node; |
| 152 | - }else { |
|
| 152 | + } else { |
|
| 153 | 153 | $errorMessage = 'COULD NOT BUILD NODE FOR KEY: '.$key; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - }else { |
|
| 156 | + } else { |
|
| 157 | 157 | $errorMessage = 'NO CONFIG FOR KEY: '.$key; |
| 158 | 158 | } |
| 159 | 159 | $this->doFireEvent(self::EVENT_CREATE_SERVICE_ERROR, array( |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | self::HEADER_NODE => $nodeInstance |
| 198 | 198 | )); |
| 199 | 199 | return $nodeInstance; |
| 200 | - }else { |
|
| 200 | + } else { |
|
| 201 | 201 | $errorMessage = 'BUILDER RETURNED NO OBJECT FOR NODE-TYPE: '.$nodeName; |
| 202 | 202 | } |
| 203 | - }else { |
|
| 203 | + } else { |
|
| 204 | 204 | $errorMessage = 'NO BUILDER FOUND FOR NODE-TYPE: '.$nodeName; |
| 205 | 205 | } |
| 206 | 206 | |