@@ -22,17 +22,17 @@ |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | |
25 | -use PEIP\Handler\CallableHandler; |
|
26 | -use PEIP\Service\HeaderServiceActivator; |
|
27 | -use PEIP\Channel\ChannelRegistry; |
|
28 | -use PEIP\Service\ServiceProvider; |
|
29 | -use PEIP\Plugins\BasePlugin; |
|
30 | -use PEIP\Factory\ServiceFactory; |
|
31 | -use PEIP\Base\GenericBuilder; |
|
32 | -use PEIP\Channel\PollableChannel; |
|
33 | -use PEIP\Channel\PublishSubscribeChannel; |
|
34 | -use PEIP\Gateway\SimpleMessagingGateway; |
|
35 | -use PEIP\Listener\Wiretap; |
|
25 | +use PEIP\Handler\CallableHandler; |
|
26 | +use PEIP\Service\HeaderServiceActivator; |
|
27 | +use PEIP\Channel\ChannelRegistry; |
|
28 | +use PEIP\Service\ServiceProvider; |
|
29 | +use PEIP\Plugins\BasePlugin; |
|
30 | +use PEIP\Factory\ServiceFactory; |
|
31 | +use PEIP\Base\GenericBuilder; |
|
32 | +use PEIP\Channel\PollableChannel; |
|
33 | +use PEIP\Channel\PublishSubscribeChannel; |
|
34 | +use PEIP\Gateway\SimpleMessagingGateway; |
|
35 | +use PEIP\Listener\Wiretap; |
|
36 | 36 | use PEIP\Service\ServiceActivator; |
37 | 37 | |
38 | 38 | class XMLContext |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public static function createFromFile($file){ |
102 | 102 | if(file_exists($file)){ |
103 | 103 | return self::createFromString(file_get_contents($file)); |
104 | - }else{ |
|
104 | + } else{ |
|
105 | 105 | throw new \RuntimeException('Cannot open file "'.$file.'".'); |
106 | 106 | } |
107 | 107 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $setter = self::getSetter($property); |
394 | 394 | if($setter && self::hasPublicProperty($service, 'Method', $setter)){ |
395 | 395 | $service->{$setter}($arg); |
396 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
396 | + } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
397 | 397 | $service->$setter = $arg; |
398 | 398 | } |
399 | 399 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $ref = trim((string)$config['ref']); |
627 | 627 | if($ref != ''){ |
628 | 628 | $service = $this->getService($ref); |
629 | - }else{ |
|
629 | + } else{ |
|
630 | 630 | $service = $this->createService($config); |
631 | 631 | } |
632 | 632 | return $service; |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | protected static function getSetter($config){ |
647 | 647 | if($config['setter']){ |
648 | 648 | $setter = (string)$config['setter']; |
649 | - }elseif($config['name']){ |
|
649 | + } elseif($config['name']){ |
|
650 | 650 | $setter = 'set'.ucfirst((string)$config['name']); |
651 | 651 | } |
652 | 652 | return $setter; |
@@ -662,26 +662,26 @@ discard block |
||
662 | 662 | protected function buildArg($config){ |
663 | 663 | if(trim((string)$config['value']) != ''){ |
664 | 664 | $arg = (string)$config['value']; |
665 | - }elseif($config->getName() == 'value'){ |
|
665 | + } elseif($config->getName() == 'value'){ |
|
666 | 666 | $arg = (string)$config; |
667 | - }elseif($config->getName() == 'list'){ |
|
667 | + } elseif($config->getName() == 'list'){ |
|
668 | 668 | $arg = array(); |
669 | 669 | foreach($config->children() as $entry){ |
670 | 670 | if($entry->getName() == 'value'){ |
671 | 671 | if($entry['key']){ |
672 | 672 | $arg[(string)$entry['key']] = (string)$entry; |
673 | - }else{ |
|
673 | + } else{ |
|
674 | 674 | $arg[] = (string)$entry; |
675 | 675 | } |
676 | - }elseif($entry->getName() == 'service'){ |
|
676 | + } elseif($entry->getName() == 'service'){ |
|
677 | 677 | $arg[] = $this->provideService($entry); |
678 | 678 | } |
679 | 679 | } |
680 | - }elseif($config->getName() == 'service'){ |
|
680 | + } elseif($config->getName() == 'service'){ |
|
681 | 681 | $arg = $this->provideService($config); |
682 | - }elseif($config->list){ |
|
682 | + } elseif($config->list){ |
|
683 | 683 | $arg = $this->buildArg($config->list); |
684 | - }elseif($config->service){ |
|
684 | + } elseif($config->service){ |
|
685 | 685 | $arg = $this->buildArg($config->service); |
686 | 686 | } |
687 | 687 | return $arg; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | $channel = $this->services[trim((string)$channelName)]; |
750 | 750 | if($channel instanceof \PEIP\INF\Channel\Channel){ |
751 | 751 | return $channel; |
752 | - }else{ |
|
752 | + } else{ |
|
753 | 753 | return NULL; |
754 | 754 | } |
755 | 755 | } |
@@ -770,14 +770,14 @@ discard block |
||
770 | 770 | public function buildAndModify($config, $arguments, $defaultClass = false){ |
771 | 771 | if("" != (string)$config["class"] || $defaultClass){ |
772 | 772 | $service = ServiceFactory::doBuild($config, $arguments, $defaultClass); |
773 | - }elseif($config["ref"]){ |
|
773 | + } elseif($config["ref"]){ |
|
774 | 774 | $service = $this->getService((string)$config['ref']); |
775 | - }else{ |
|
775 | + } else{ |
|
776 | 776 | throw new \RuntimeException('Could not create Service. no class or reference given.'); |
777 | 777 | } |
778 | 778 | if($config["ref_property"]){ |
779 | 779 | $service = $service->{(string)$config["ref_property"]}; |
780 | - }elseif($config["ref_method"]){ |
|
780 | + } elseif($config["ref_method"]){ |
|
781 | 781 | $args = array(); |
782 | 782 | if($config->argument){ |
783 | 783 | foreach($config->argument as $arg){ |
@@ -814,10 +814,10 @@ discard block |
||
814 | 814 | $constructor = (string)$config["constructor"]; |
815 | 815 | if($constructor != ''){ |
816 | 816 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
817 | - }else{ |
|
817 | + } else{ |
|
818 | 818 | $service = self::build($cls, $arguments); |
819 | 819 | } |
820 | - }catch(\Exception $e){ |
|
820 | + } catch(\Exception $e){ |
|
821 | 821 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage()); |
822 | 822 | } |
823 | 823 | } |
@@ -11,8 +11,7 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Util\Reflection; |
|
15 | -use PEIP\Util\ReflectionPool; |
|
14 | +use PEIP\Util\Reflection; |
|
16 | 15 | use PEIP\Event\EventBuilder; |
17 | 16 | |
18 | 17 | class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher { |
@@ -70,10 +70,10 @@ |
||
70 | 70 | ), |
71 | 71 | $object |
72 | 72 | ); |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
75 | 75 | } |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
78 | 78 | } |
79 | 79 | } //put your code here |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Event\EventBuilder; |
|
14 | +use PEIP\Event\EventBuilder; |
|
15 | 15 | use PEIP\Util\ReflectionPool; |
16 | 16 | |
17 | 17 | class EventClassDispatcher |
@@ -70,10 +70,10 @@ |
||
70 | 70 | ), |
71 | 71 | $object |
72 | 72 | ); |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
75 | 75 | } |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
78 | 78 | } |
79 | 79 | } //put your code here |
@@ -11,8 +11,8 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Util\Test; |
|
15 | -use PEIP\Base\GenericBuilder; |
|
14 | +use PEIP\Util\Test; |
|
15 | +use PEIP\Base\GenericBuilder; |
|
16 | 16 | use PEIP\Context\XMLContext; |
17 | 17 | |
18 | 18 | class ServiceFactory { |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | $constructor = (string)$config["constructor"]; |
52 | 52 | if($constructor != '' && Test::assertMethod($cls, $constructor)){ |
53 | 53 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | $service = self::build($cls, $arguments); |
56 | 56 | } |
57 | - }catch(\Exception $e){ |
|
57 | + } catch(\Exception $e){ |
|
58 | 58 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage()); |
59 | 59 | } |
60 | 60 | } |
@@ -89,26 +89,26 @@ discard block |
||
89 | 89 | protected static function buildArg($config){ |
90 | 90 | if(trim((string)$config['value']) != ''){ |
91 | 91 | $arg = (string)$config['value']; |
92 | - }elseif($config->getName() == 'value'){ |
|
92 | + } elseif($config->getName() == 'value'){ |
|
93 | 93 | $arg = (string)$config; |
94 | - }elseif($config->getName() == 'list'){ |
|
94 | + } elseif($config->getName() == 'list'){ |
|
95 | 95 | $arg = array(); |
96 | 96 | foreach($config->children() as $entry){ |
97 | 97 | if($entry->getName() == 'value'){ |
98 | 98 | if($entry['key']){ |
99 | 99 | $arg[(string)$entry['key']] = (string)$entry; |
100 | - }else{ |
|
100 | + } else{ |
|
101 | 101 | $arg[] = (string)$entry; |
102 | 102 | } |
103 | - }elseif($entry->getName() == 'service'){ |
|
103 | + } elseif($entry->getName() == 'service'){ |
|
104 | 104 | $arg[] = $this->provideService($entry); |
105 | 105 | } |
106 | 106 | } |
107 | - }elseif($config->getName() == 'service'){ |
|
107 | + } elseif($config->getName() == 'service'){ |
|
108 | 108 | $arg = self::provideService($config); |
109 | - }elseif($config->list){ |
|
109 | + } elseif($config->list){ |
|
110 | 110 | $arg = self::buildArg($config->list); |
111 | - }elseif($config->service){ |
|
111 | + } elseif($config->service){ |
|
112 | 112 | $arg = self::buildArg($config->service); |
113 | 113 | } |
114 | 114 | return $arg; |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | public static function buildAndModify($config, $arguments, $defaultClass = false){ |
130 | 130 | if("" != (string)$config["class"] || $defaultClass){ |
131 | 131 | $service = ServiceFactory::doBuild($config, $arguments, $defaultClass); |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | throw new \RuntimeException('Could not create Service. no class or reference given.'); |
134 | 134 | } |
135 | 135 | if($config["ref_property"]){ |
136 | 136 | $service = $service->{(string)$config["ref_property"]}; |
137 | - }elseif($config["ref_method"]){ |
|
137 | + } elseif($config["ref_method"]){ |
|
138 | 138 | $args = array(); |
139 | 139 | if($config->argument){ |
140 | 140 | foreach($config->argument as $arg){ |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $setter = self::getSetter($property); |
177 | 177 | if($setter && self::hasPublicProperty($service, 'Method', $setter)){ |
178 | 178 | $service->{$setter}($arg); |
179 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
179 | + } elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
180 | 180 | $service->$setter = $arg; |
181 | 181 | } |
182 | 182 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @implements \PEIP\INF\Gateway\MessagingGateway, \PEIP\INF\Message\MessageBuilder |
21 | 21 | */ |
22 | 22 | |
23 | -use PEIP\Message\GenericMessage; |
|
23 | +use PEIP\Message\GenericMessage; |
|
24 | 24 | use PEIP\Message\MessageBuilder; |
25 | 25 | |
26 | 26 | class SimpleMessagingGateway |
@@ -116,8 +116,7 @@ |
||
116 | 116 | $this->send($content); |
117 | 117 | try { |
118 | 118 | $res = $this->receive(); |
119 | - } |
|
120 | - catch(\Exception $e){ |
|
119 | + } catch(\Exception $e){ |
|
121 | 120 | return NULL; |
122 | 121 | } |
123 | 122 | return $res; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @implements \PEIP\INF\Base\Container, \PEIP\INF\Message\Message, \PEIP\INF\Base\Buildable |
21 | 21 | */ |
22 | 22 | |
23 | -use PEIP\Util\Test; |
|
23 | +use PEIP\Util\Test; |
|
24 | 24 | use PEIP\Base\GenericBuilder; |
25 | 25 | |
26 | 26 | class GenericMessage |
@@ -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 | |
144 | 142 | } |
145 | 143 | } |
@@ -24,8 +24,8 @@ |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | |
27 | -use PEIP\Dispatcher\Dispatcher; |
|
28 | -use PEIP\Event\Event; |
|
27 | +use PEIP\Dispatcher\Dispatcher; |
|
28 | +use PEIP\Event\Event; |
|
29 | 29 | use PEIP\Util\Test; |
30 | 30 | |
31 | 31 | class Pipe |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $store = $this->factory->build(); |
55 | 55 | if($store instanceof \PEIP\INF\Data\Store){ |
56 | 56 | $this->setPrivateValue($namespace, $store); |
57 | - }else{ |
|
57 | + } else{ |
|
58 | 58 | throw new \Exception('Could not build Instance of \PEIP\INF\Data\Store from factory.'); |
59 | 59 | } |
60 | 60 | } |
@@ -11,11 +11,11 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Context\XMLContext; |
|
15 | -use PEIP\Channel\PollableChannel; |
|
16 | -use PEIP\Channel\PublishSubscribeChannel; |
|
17 | -use PEIP\Gateway\SimpleMessagingGateway; |
|
18 | -use PEIP\Listener\Wiretap; |
|
14 | +use PEIP\Context\XMLContext; |
|
15 | +use PEIP\Channel\PollableChannel; |
|
16 | +use PEIP\Channel\PublishSubscribeChannel; |
|
17 | +use PEIP\Gateway\SimpleMessagingGateway; |
|
18 | +use PEIP\Listener\Wiretap; |
|
19 | 19 | use PEIP\Service\ServiceActivator; |
20 | 20 | |
21 | 21 | class BasePlugin extends \PEIP\ABS\Context\ContextPlugin { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | protected function getMessage($object){ |
18 | 18 | if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){ |
19 | 19 | return $object; |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | return $object->getContent()->receive(); |
22 | 22 | } |
23 | 23 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Context\XMLContext; |
|
14 | +use PEIP\Context\XMLContext; |
|
15 | 15 | use PEIP\Plugins\BasePlugin; |
16 | 16 | |
17 | 17 | class ServiceProvider extends \PEIP\Service\ServiceContainer { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | if($this->hasService($key)){ |
121 | 121 | $service = $this->getService($key); |
122 | - }else{ |
|
122 | + } else{ |
|
123 | 123 | $service = $this->createService($key); |
124 | 124 | } |
125 | 125 | |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | )); |
152 | 152 | |
153 | 153 | return $node; |
154 | - }else{ |
|
154 | + } else{ |
|
155 | 155 | $errorMessage = 'COULD NOT BUILD NODE FOR KEY: '.$key; |
156 | 156 | } |
157 | 157 | |
158 | - }else{ |
|
158 | + } else{ |
|
159 | 159 | $errorMessage = 'NO CONFIG FOR KEY: '.$key; |
160 | 160 | } |
161 | 161 | $this->doFireEvent(self::EVENT_CREATE_SERVICE_ERROR, array( |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | self::HEADER_NODE => $nodeInstance |
200 | 200 | )); |
201 | 201 | return $nodeInstance; |
202 | - }else{ |
|
202 | + } else{ |
|
203 | 203 | $errorMessage = 'BUILDER RETURNED NO OBJECT FOR NODE-TYPE: '.$nodeName; |
204 | 204 | } |
205 | - }else{ |
|
205 | + } else{ |
|
206 | 206 | $errorMessage = 'NO BUILDER FOUND FOR NODE-TYPE: '.$nodeName; |
207 | 207 | } |
208 | 208 |