@@ -342,7 +342,7 @@ |
||
342 | 342 | * |
343 | 343 | * @access protected |
344 | 344 | * @param object $config |
345 | - * @return object the initialized service instance |
|
345 | + * @return \PEIP\INF\Context\ContextPlugin|null the initialized service instance |
|
346 | 346 | */ |
347 | 347 | protected function initService($config) { |
348 | 348 | $id = trim((string)$config['id']); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public static function createFromFile($file) { |
95 | 95 | if (file_exists($file)) { |
96 | 96 | return self::createFromString(file_get_contents($file)); |
97 | - }else { |
|
97 | + } else { |
|
98 | 98 | throw new \RuntimeException('Cannot open file "'.$file.'".'); |
99 | 99 | } |
100 | 100 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $setter = self::getSetter($property); |
385 | 385 | if ($setter && self::hasPublicProperty($service, 'Method', $setter)) { |
386 | 386 | $service->{$setter}($arg); |
387 | - }elseif (in_array($property, self::hasPublicProperty($service, 'Property', $setter))) { |
|
387 | + } elseif (in_array($property, self::hasPublicProperty($service, 'Property', $setter))) { |
|
388 | 388 | $service->$setter = $arg; |
389 | 389 | } |
390 | 390 | } |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $ref = trim((string)$config['ref']); |
618 | 618 | if ($ref != '') { |
619 | 619 | $service = $this->getService($ref); |
620 | - }else { |
|
620 | + } else { |
|
621 | 621 | $service = $this->createService($config); |
622 | 622 | } |
623 | 623 | return $service; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | protected static function getSetter($config) { |
638 | 638 | if ($config['setter']) { |
639 | 639 | $setter = (string)$config['setter']; |
640 | - }elseif ($config['name']) { |
|
640 | + } elseif ($config['name']) { |
|
641 | 641 | $setter = 'set'.ucfirst((string)$config['name']); |
642 | 642 | } |
643 | 643 | return $setter; |
@@ -653,26 +653,26 @@ discard block |
||
653 | 653 | protected function buildArg($config) { |
654 | 654 | if (trim((string)$config['value']) != '') { |
655 | 655 | $arg = (string)$config['value']; |
656 | - }elseif ($config->getName() == 'value') { |
|
656 | + } elseif ($config->getName() == 'value') { |
|
657 | 657 | $arg = (string)$config; |
658 | - }elseif ($config->getName() == 'list') { |
|
658 | + } elseif ($config->getName() == 'list') { |
|
659 | 659 | $arg = array(); |
660 | 660 | foreach ($config->children() as $entry) { |
661 | 661 | if ($entry->getName() == 'value') { |
662 | 662 | if ($entry['key']) { |
663 | 663 | $arg[(string)$entry['key']] = (string)$entry; |
664 | - }else { |
|
664 | + } else { |
|
665 | 665 | $arg[] = (string)$entry; |
666 | 666 | } |
667 | - }elseif ($entry->getName() == 'service') { |
|
667 | + } elseif ($entry->getName() == 'service') { |
|
668 | 668 | $arg[] = $this->provideService($entry); |
669 | 669 | } |
670 | 670 | } |
671 | - }elseif ($config->getName() == 'service') { |
|
671 | + } elseif ($config->getName() == 'service') { |
|
672 | 672 | $arg = $this->provideService($config); |
673 | - }elseif ($config->list) { |
|
673 | + } elseif ($config->list) { |
|
674 | 674 | $arg = $this->buildArg($config->list); |
675 | - }elseif ($config->service) { |
|
675 | + } elseif ($config->service) { |
|
676 | 676 | $arg = $this->buildArg($config->service); |
677 | 677 | } |
678 | 678 | return $arg; |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $constructor = (string)$config["constructor"]; |
775 | 775 | if ($constructor != '') { |
776 | 776 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
777 | - }else { |
|
777 | + } else { |
|
778 | 778 | $service = self::build($cls, $arguments); |
779 | 779 | } |
780 | 780 | } catch (\Exception $e) { |
@@ -87,7 +87,7 @@ |
||
87 | 87 | * @param array $headers headers of the event-object as key/value pairs |
88 | 88 | * @param string $eventClass event-class to create instances from |
89 | 89 | * @return |
90 | - * @see EventBuilder |
|
90 | + boolean|null @see EventBuilder |
|
91 | 91 | */ |
92 | 92 | public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){ |
93 | 93 | if(!$this->hasListeners($name, ($object))){ |
@@ -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 | } |
@@ -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 | } |