@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param \PEIP\INF\Channel\Channel $outputChannel the outputs-channel |
36 | 36 | * @return |
37 | 37 | */ |
38 | - public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL){ |
|
38 | + public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL) { |
|
39 | 39 | $this->setInputChannel($inputChannel); |
40 | - if(is_object($outputChannel)){ |
|
40 | + if (is_object($outputChannel)) { |
|
41 | 41 | $this->setOutputChannel($outputChannel); |
42 | 42 | } |
43 | 43 | } |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @param \PEIP\INF\Message\Message $message message to split |
50 | 50 | * @return |
51 | 51 | */ |
52 | - public function doReply(\PEIP\INF\Message\Message $message){ |
|
52 | + public function doReply(\PEIP\INF\Message\Message $message) { |
|
53 | 53 | $res = $this->split($message); |
54 | - if(is_array($res)){ |
|
55 | - foreach($res as $msg){ |
|
54 | + if (is_array($res)) { |
|
55 | + foreach ($res as $msg) { |
|
56 | 56 | $this->replyMessage($msg); |
57 | 57 | } |
58 | - }else{ |
|
58 | + }else { |
|
59 | 59 | $this->replyMessage($res); |
60 | 60 | } |
61 | 61 | } |
@@ -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 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param $outputChannel |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public function __construct($eventName, \PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel){ |
|
36 | + public function __construct($eventName, \PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel) { |
|
37 | 37 | $this->setEventName($eventName); |
38 | 38 | $this->setInputChannel($inputChannel); |
39 | 39 | $this->setOutputChannel($outputChannel); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param $type |
48 | 48 | * @return |
49 | 49 | */ |
50 | - public function __construct($type){ |
|
50 | + public function __construct($type) { |
|
51 | 51 | $this->type = $type; |
52 | 52 | } |
53 | 53 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param $message |
58 | 58 | * @return |
59 | 59 | */ |
60 | - public function acceptMessage(\PEIP\INF\Message\Message $message){ |
|
60 | + public function acceptMessage(\PEIP\INF\Message\Message $message) { |
|
61 | 61 | return call_user_func(self::$types[$this->type], $message->getContent()); |
62 | 62 | } |
63 | 63 |
@@ -23,26 +23,26 @@ |
||
23 | 23 | |
24 | 24 | interface ParameterHolderCollection { |
25 | 25 | |
26 | - public function setParameters($namespace, array $parameters); |
|
26 | + public function setParameters($namespace, array $parameters); |
|
27 | 27 | |
28 | - public function addParameters($namespace, array $parameters); |
|
28 | + public function addParameters($namespace, array $parameters); |
|
29 | 29 | |
30 | - public function getParameters($namespace); |
|
30 | + public function getParameters($namespace); |
|
31 | 31 | |
32 | - public function getParameter($namespace, $name); |
|
32 | + public function getParameter($namespace, $name); |
|
33 | 33 | |
34 | - public function setParameter($namespace, $name, $value); |
|
34 | + public function setParameter($namespace, $name, $value); |
|
35 | 35 | |
36 | - public function hasParameter($namespace, $name); |
|
36 | + public function hasParameter($namespace, $name); |
|
37 | 37 | |
38 | - public function deleteParameter($namespace, $name); |
|
38 | + public function deleteParameter($namespace, $name); |
|
39 | 39 | |
40 | - public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder); |
|
40 | + public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder); |
|
41 | 41 | |
42 | - public function getParameterHolder($namespace); |
|
42 | + public function getParameterHolder($namespace); |
|
43 | 43 | |
44 | - public function hasParameterHolder($namespace); |
|
44 | + public function hasParameterHolder($namespace); |
|
45 | 45 | |
46 | - public function deleteParameterHolder($namespace); |
|
46 | + public function deleteParameterHolder($namespace); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @return array array with interface/class info for the class |
31 | 31 | */ |
32 | 32 | |
33 | - public static function getImplementedClassesAndInterfaces($class, $store = true){ |
|
33 | + public static function getImplementedClassesAndInterfaces($class, $store = true) { |
|
34 | 34 | $class = is_object($class) ? get_class($class) : (string)$class; |
35 | - if(isset(self::$classInfo[$class])){ |
|
35 | + if (isset(self::$classInfo[$class])) { |
|
36 | 36 | return self::$classInfo[$class]; |
37 | 37 | } |
38 | 38 | $cls = ReflectionPool::getInstance($class); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $classInfo = (array)$cls->getInterfaceNames(); |
41 | 41 | $classInfo[] = $cls->getName(); |
42 | 42 | // get names of parent-classes |
43 | - while($cls = $cls->getParentClass()){ |
|
43 | + while ($cls = $cls->getParentClass()) { |
|
44 | 44 | $classInfo[] = $cls->getName(); |
45 | 45 | } |
46 | 46 |
@@ -64,7 +64,6 @@ |
||
64 | 64 | * @static |
65 | 65 | * @access public |
66 | 66 | * @implements \PEIP\INF\Base\Buildable |
67 | - * @param string $name the name of the header |
|
68 | 67 | * @return boolean wether the header is set |
69 | 68 | */ |
70 | 69 | public static function build(array $arguments = array()){ |
@@ -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 | } |
@@ -38,12 +38,12 @@ |
||
38 | 38 | * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload |
39 | 39 | * @return mixed result of calling the registered service callable with message content/payload |
40 | 40 | */ |
41 | - protected function callService(\PEIP\INF\Message\Message $message){ |
|
41 | + protected function callService(\PEIP\INF\Message\Message $message) { |
|
42 | 42 | $res = NULL; |
43 | - if(is_callable($this->serviceCallable)){ |
|
43 | + if (is_callable($this->serviceCallable)) { |
|
44 | 44 | $res = call_user_func($this->serviceCallable, $message->getHeader($this->headerName)); |
45 | - }else{ |
|
46 | - if(is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')){ |
|
45 | + }else { |
|
46 | + if (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) { |
|
47 | 47 | $res = $this->serviceCallable->handle($message->getHeader($this->headerName)); |
48 | 48 | } |
49 | 49 | } |
@@ -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 | } |
@@ -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; |
@@ -35,10 +35,10 @@ |
||
35 | 35 | ), |
36 | 36 | $object->getContent() |
37 | 37 | ); |
38 | - }else{ |
|
38 | + }else { |
|
39 | 39 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
40 | 40 | } |
41 | - }else{ |
|
41 | + }else { |
|
42 | 42 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
43 | 43 | } |
44 | 44 | } //put your code here |
@@ -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']); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $nodeName the name of the node |
127 | 127 | * @param callable $callable a callable which creates instances for node-name |
128 | 128 | */ |
129 | - public function registerNodeBuilder($nodeName, $callable){ |
|
129 | + public function registerNodeBuilder($nodeName, $callable) { |
|
130 | 130 | return $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable); |
131 | 131 | } |
132 | 132 | |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | * @param array $arguments arguments for the constructor |
798 | 798 | * @return object build and modified srvice instance |
799 | 799 | */ |
800 | - protected static function build($className, $arguments){ |
|
800 | + protected static function build($className, $arguments) { |
|
801 | 801 | return GenericBuilder::getInstance($className)->build($arguments); |
802 | 802 | } |
803 | 803 | |
@@ -805,9 +805,9 @@ discard block |
||
805 | 805 | * @param string $type |
806 | 806 | * @param string $name |
807 | 807 | */ |
808 | - protected static function hasPublicProperty($service, $type, $name){ |
|
808 | + protected static function hasPublicProperty($service, $type, $name) { |
|
809 | 809 | $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass(); |
810 | - if($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()){ |
|
810 | + if ($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()) { |
|
811 | 811 | return true; |
812 | 812 | } |
813 | 813 | return false; |
@@ -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) { |