@@ -47,6 +47,9 @@ |
||
47 | 47 | return new DedicatedFactory(array($class, '__construct'), $parameters); |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string[] $callable |
|
52 | + */ |
|
50 | 53 | public static function getfromCallable($callable, array $parameters = array()){ |
51 | 54 | return new DedicatedFactory($callable, $parameters); |
52 | 55 | } |
@@ -112,6 +112,9 @@ |
||
112 | 112 | ); |
113 | 113 | } |
114 | 114 | |
115 | + /** |
|
116 | + * @param string $key |
|
117 | + */ |
|
115 | 118 | public function provideService($key){ |
116 | 119 | $this->doFireEvent(self::EVENT_BEFORE_PROVIDE_SERVICE, array( |
117 | 120 | self::HEADER_KEY=>$key) |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param string $nodeName the name of the node |
70 | 70 | * @param callable $callable a callable which creates instances for node-name |
71 | 71 | */ |
72 | - public function registerNodeBuilder($nodeName, $callable){ |
|
72 | + public function registerNodeBuilder($nodeName, $callable) { |
|
73 | 73 | $this->nodeBuilders[$nodeName] = $callable; |
74 | 74 | } |
75 | 75 | /** |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | * @see XMLContext::includeContext |
83 | 83 | * @access protected |
84 | 84 | */ |
85 | - protected function initNodeBuilders(){ |
|
85 | + protected function initNodeBuilders() { |
|
86 | 86 | $builders = array( |
87 | 87 | 'service' => 'initService' |
88 | 88 | ); |
89 | - foreach($builders as $nodeName => $method){ |
|
89 | + foreach ($builders as $nodeName => $method) { |
|
90 | 90 | $this->registerNodeBuilder($nodeName, array($this, $method)); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - public function addConfig($config){ |
|
94 | + public function addConfig($config) { |
|
95 | 95 | $this->doFireEvent( |
96 | 96 | self::EVENT_BEFORE_ADD_CONFIG, |
97 | 97 | array( |
@@ -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 |
@@ -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 |
@@ -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))){ |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @param Callable|PEIP\INF\Handler\Handler $listener event-handler |
27 | 27 | * @return boolean |
28 | 28 | */ |
29 | - public function connect($name, $object, $listener){ |
|
29 | + public function connect($name, $object, $listener) { |
|
30 | 30 | $class = is_object($object) ? get_class($object) : (string)$object; |
31 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){ |
|
31 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) { |
|
32 | 32 | $reflection = \PEIP\Util\ReflectionPool::getInstance($class); |
33 | 33 | parent::connect($name, $reflection, $listener); |
34 | 34 | } |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | |
39 | - public function disconnect($name, $object, $listener){ |
|
39 | + public function disconnect($name, $object, $listener) { |
|
40 | 40 | $class = is_object($object) ? get_class($object) : (string)$object; |
41 | 41 | $res = true; |
42 | - foreach(Reflection::getImplementedClassesAndInterfaces($object) as $cls){ |
|
42 | + foreach (Reflection::getImplementedClassesAndInterfaces($object) as $cls) { |
|
43 | 43 | $reflection = \PEIP\Util\ReflectionPool::getInstance($class); |
44 | 44 | $r = parent::disconnect($name, $reflection, $listener); |
45 | - if(!$r){ |
|
45 | + if (!$r) { |
|
46 | 46 | $res = false; |
47 | 47 | } |
48 | 48 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | ), |
70 | 70 | $object |
71 | 71 | ); |
72 | - }else{ |
|
72 | + }else { |
|
73 | 73 | throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject'); |
74 | 74 | } |
75 | - }else{ |
|
75 | + }else { |
|
76 | 76 | throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event'); |
77 | 77 | } |
78 | 78 | } //put your code here |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @return |
90 | 90 | * @see EventBuilder |
91 | 91 | */ |
92 | - public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){ |
|
93 | - if(!$this->hasListeners($name, ($object))){ |
|
92 | + public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) { |
|
93 | + if (!$this->hasListeners($name, ($object))) { |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 |
@@ -46,19 +46,19 @@ |
||
46 | 46 | |
47 | 47 | if($cafe){ |
48 | 48 | |
49 | - for ($i = 1; $i <= 10; $i++) { |
|
50 | - // create and place orders |
|
51 | - $order = new Order(); |
|
52 | - $order->addItem("LATTE", 2, false); |
|
53 | - $order->addItem("MOCCA", 3, true); |
|
54 | - $cafe->placeOrder($order); |
|
55 | - // receive drinks |
|
56 | - $drinks = $cafe->receiveDelivery(); |
|
49 | + for ($i = 1; $i <= 10; $i++) { |
|
50 | + // create and place orders |
|
51 | + $order = new Order(); |
|
52 | + $order->addItem("LATTE", 2, false); |
|
53 | + $order->addItem("MOCCA", 3, true); |
|
54 | + $cafe->placeOrder($order); |
|
55 | + // receive drinks |
|
56 | + $drinks = $cafe->receiveDelivery(); |
|
57 | 57 | var_dump($drinks); |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | }else{ |
61 | - throw new RuntimeException('Could not get CafeGateway'); |
|
61 | + throw new RuntimeException('Could not get CafeGateway'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 |
@@ -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 |
@@ -4,14 +4,14 @@ |
||
4 | 4 | use PEIP\INF\Message\Message; |
5 | 5 | |
6 | 6 | class DrinkRouter |
7 | - extends Router { |
|
7 | + extends Router { |
|
8 | 8 | |
9 | - protected function selectChannels(Message $message){ |
|
10 | - $order = $message->getContent(); |
|
11 | - $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
12 | - echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName"; |
|
13 | - return $channelName; |
|
14 | - } |
|
9 | + protected function selectChannels(Message $message){ |
|
10 | + $order = $message->getContent(); |
|
11 | + $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
12 | + echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName"; |
|
13 | + return $channelName; |
|
14 | + } |
|
15 | 15 | |
16 | 16 | |
17 | 17 | } |
@@ -6,9 +6,9 @@ |
||
6 | 6 | class DrinkRouter |
7 | 7 | extends Router { |
8 | 8 | |
9 | - protected function selectChannels(Message $message){ |
|
9 | + protected function selectChannels(Message $message) { |
|
10 | 10 | $order = $message->getContent(); |
11 | - $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
11 | + $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
12 | 12 | echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName"; |
13 | 13 | return $channelName; |
14 | 14 | } |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | use PEIP\Context\XMLContext; |
17 | 17 | |
18 | 18 | class ServiceFactory { |
19 | - /** |
|
20 | - * Creates and initializes service instance from a given configuration. |
|
21 | - * |
|
22 | - * @access public |
|
23 | - * @param $config configuration of the service |
|
24 | - * @return object the initialized service instance |
|
25 | - */ |
|
19 | + /** |
|
20 | + * Creates and initializes service instance from a given configuration. |
|
21 | + * |
|
22 | + * @access public |
|
23 | + * @param $config configuration of the service |
|
24 | + * @return object the initialized service instance |
|
25 | + */ |
|
26 | 26 | public static function createService(array $config){ |
27 | 27 | $args = array(); |
28 | 28 | //build arguments for constructor |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Builds an arbitrary service/object instance from a config-obect. |
|
39 | - * |
|
40 | - * @static |
|
41 | - * @access protected |
|
42 | - * @param object $config configuration object to build a service instance from. |
|
43 | - * @param array $arguments arguments for the service constructor |
|
44 | - * @param string $defaultClass class to create instance for if none is set in config |
|
45 | - * @return object build and modified srvice instance |
|
46 | - */ |
|
38 | + * Builds an arbitrary service/object instance from a config-obect. |
|
39 | + * |
|
40 | + * @static |
|
41 | + * @access protected |
|
42 | + * @param object $config configuration object to build a service instance from. |
|
43 | + * @param array $arguments arguments for the service constructor |
|
44 | + * @param string $defaultClass class to create instance for if none is set in config |
|
45 | + * @return object build and modified srvice instance |
|
46 | + */ |
|
47 | 47 | public static function doBuild($config, $arguments, $defaultClass = false){ |
48 | 48 | $cls = isset($config["class"]) ? trim((string)$config["class"]) : (string)$defaultClass; |
49 | 49 | if($cls != ''){ |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | - * Builds single argument (to call a method with later) from a config-obect. |
|
84 | - * |
|
85 | - * @access protected |
|
86 | - * @param object $config configuration object to create argument from. |
|
87 | - * @return mixed build argument |
|
88 | - */ |
|
83 | + * Builds single argument (to call a method with later) from a config-obect. |
|
84 | + * |
|
85 | + * @access protected |
|
86 | + * @param object $config configuration object to create argument from. |
|
87 | + * @return mixed build argument |
|
88 | + */ |
|
89 | 89 | protected function buildArg($config){ |
90 | 90 | if(trim((string)$config['value']) != ''){ |
91 | 91 | $arg = (string)$config['value']; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function buildAndModify(array $config, $arguments, $defaultClass = ""){ |
130 | 130 | if((isset($config["class"]) && "" != (string)$config["class"]) || $defaultClass !== ""){ |
131 | - $service = ServiceFactory::doBuild($config, $arguments, $defaultClass); |
|
131 | + $service = ServiceFactory::doBuild($config, $arguments, $defaultClass); |
|
132 | 132 | }else{ |
133 | 133 | throw new \RuntimeException('Could not create Service. no class or reference given.'); |
134 | 134 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $constructor = isset($config["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 | 57 | } catch (\Exception $e) { |
@@ -97,7 +97,7 @@ discard block |
||
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 | 103 | } elseif ($entry->getName() == 'service') { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public static function buildAndModify(array $config, $arguments, $defaultClass = "") { |
130 | 130 | if ((isset($config["class"]) && "" != (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 (isset($config["ref_property"])) { |
@@ -65,7 +65,6 @@ |
||
65 | 65 | * Disconnects all listeners. |
66 | 66 | * |
67 | 67 | * @access public |
68 | - * @param Callable|PEIP\INF\Handler\Handler $listener |
|
69 | 68 | * @return void |
70 | 69 | */ |
71 | 70 | public function disconnectAll(){ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param Callable|PEIP\INF\Handler\Handler $listener |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function connect($listener){ |
|
43 | + public function connect($listener) { |
|
44 | 44 | Test::ensureHandler($listener); |
45 | 45 | $this->listeners[] = $listener; |
46 | 46 | } |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * @param Callable|PEIP\INF\Handler\Handler $listener |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function disconnect($listener){ |
|
55 | + public function disconnect($listener) { |
|
56 | 56 | Test::ensureHandler($listener); |
57 | - foreach ($this->listeners as $i => $callable){ |
|
58 | - if ($listener === $callable){ |
|
57 | + foreach ($this->listeners as $i => $callable) { |
|
58 | + if ($listener === $callable) { |
|
59 | 59 | unset($this->listeners[$i]); |
60 | 60 | } |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param Callable|PEIP\INF\Handler\Handler $listener |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function disconnectAll(){ |
|
71 | + public function disconnectAll() { |
|
72 | 72 | $this->listeners = array(); |
73 | 73 | } |
74 | 74 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @access public |
79 | 79 | * @return boolean wether any listeners are registered |
80 | 80 | */ |
81 | - public function hasListeners(){ |
|
82 | - return (boolean) count($this->listeners); |
|
81 | + public function hasListeners() { |
|
82 | + return (boolean)count($this->listeners); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | * @param mixed $subject the subject |
90 | 90 | * @return void |
91 | 91 | */ |
92 | - public function notify($subject){ |
|
92 | + public function notify($subject) { |
|
93 | 93 | $res = NULL; |
94 | - if($this->hasListeners()){ |
|
94 | + if ($this->hasListeners()) { |
|
95 | 95 | $res = self::doNotify($this->getListeners(), $subject); |
96 | 96 | } |
97 | 97 | return $res; |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param mixed $subject the subject |
105 | 105 | * @return \PEIP\INF\Handler\Handler the listener which returned a boolean true value |
106 | 106 | */ |
107 | - public function notifyUntil($subject){ |
|
108 | - if($this->hasListeners()){ |
|
107 | + public function notifyUntil($subject) { |
|
108 | + if ($this->hasListeners()) { |
|
109 | 109 | $res = self::doNotifyUntil($this->getListeners(), $subject); |
110 | 110 | } |
111 | 111 | return $res; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @access public |
118 | 118 | * @return array the listeners |
119 | 119 | */ |
120 | - public function getListeners(){ |
|
120 | + public function getListeners() { |
|
121 | 121 | return $this->listeners; |
122 | 122 | } |
123 | 123 |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @access protected |
215 | 215 | * @param object $config configuration object to create arguments from. |
216 | - * @return mixed build arguments |
|
216 | + * @return \PEIP\INF\Channel\Channel[] build arguments |
|
217 | 217 | */ |
218 | 218 | protected function getReplyHandlerArguments($config){ |
219 | 219 | $args = array( |
@@ -259,6 +259,7 @@ discard block |
||
259 | 259 | * @access protected |
260 | 260 | * @param string the configuration type ofthe channel (e.g.: 'reply', 'request') |
261 | 261 | * @param object $config configuration object to return channel from. |
262 | + * @param string $type |
|
262 | 263 | * @return \PEIP\INF\Channel\Channel reply-channel |
263 | 264 | */ |
264 | 265 | public function doGetChannel($type, $config){ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param object $config configuration object for the pollable channel. |
43 | 43 | * @return \PEIP\INF\Channel\Channel the created pollable channel instance |
44 | 44 | */ |
45 | - public function createChannel($config){ |
|
45 | + public function createChannel($config) { |
|
46 | 46 | return $this->doCreateChannel($config, '\PEIP\Channel\PollableChannel'); |
47 | 47 | } |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param object $config configuration object for the subscribable channel. |
55 | 55 | * @return \PEIP\INF\Channel\Channel the created subscribable channel instance |
56 | 56 | */ |
57 | - public function createSubscribableChannel($config){ |
|
57 | + public function createSubscribableChannel($config) { |
|
58 | 58 | return $this->doCreateChannel($config, '\PEIP\Channel\PublishSubscribeChannel'); |
59 | 59 | } |
60 | 60 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param $additionalArguments additional arguments for the channel constructor (without first arg = id) |
68 | 68 | * @return \PEIP\INF\Channel\Channel the created channel instance |
69 | 69 | */ |
70 | - public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = array()){ |
|
70 | + public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = array()) { |
|
71 | 71 | $id = (string)$config['id']; |
72 | - if($id != ''){ |
|
72 | + if ($id != '') { |
|
73 | 73 | array_unshift($additionalArguments, $id); |
74 | 74 | $channel = $this->buildAndModify($config, $additionalArguments, $defaultChannelClass); |
75 | 75 | //$this->channelRegistry->register($channel); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string $defaultClass the class to use if none is set in config. |
88 | 88 | * @return object the gateway instance |
89 | 89 | */ |
90 | - public function createGateway($config, $defaultClass = false){ |
|
90 | + public function createGateway($config, $defaultClass = false) { |
|
91 | 91 | $args = array( |
92 | 92 | $this->getRequestChannel($config), |
93 | 93 | $this->getReplyChannel($config) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $defaultClass the class to use if none is set in config. |
112 | 112 | * @return object the router instance |
113 | 113 | */ |
114 | - public function createRouter($config, $defaultClass = false){ |
|
114 | + public function createRouter($config, $defaultClass = false) { |
|
115 | 115 | $resolver = $config['channel_resolver'] ? (string)$config['channel_resolver'] : $this->channelRegistry; |
116 | 116 | return $this->buildAndModify($config, array( |
117 | 117 | $resolver, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param object $config configuration object for the splitter. |
129 | 129 | * @return object the splitter instance |
130 | 130 | */ |
131 | - public function createSplitter($config){ |
|
131 | + public function createSplitter($config) { |
|
132 | 132 | return $this->createReplyMessageHandler($config); |
133 | 133 | } |
134 | 134 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param object $config configuration object for the transformer. |
142 | 142 | * @return object the transformer instance |
143 | 143 | */ |
144 | - public function createTransformer($config){ |
|
144 | + public function createTransformer($config) { |
|
145 | 145 | return $this->createReplyMessageHandler($config); |
146 | 146 | } |
147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param object $config configuration object for the aggregator. |
155 | 155 | * @return object the aggregator instance |
156 | 156 | */ |
157 | - public function createAggregator($config){ |
|
157 | + public function createAggregator($config) { |
|
158 | 158 | return $this->createReplyMessageHandler($config); |
159 | 159 | } |
160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param object $config configuration object for the wiretap. |
168 | 168 | * @return object the wiretap instance |
169 | 169 | */ |
170 | - public function createWiretap($config){ |
|
170 | + public function createWiretap($config) { |
|
171 | 171 | return $this->createReplyMessageHandler($config, '\PEIP\Listener\Wiretap'); |
172 | 172 | } |
173 | 173 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param string $defaultClass the class to use if none is set in config. |
181 | 181 | * @return object the reply-message-handler instance |
182 | 182 | */ |
183 | - public function createReplyMessageHandler($config, $defaultClass = false){ |
|
183 | + public function createReplyMessageHandler($config, $defaultClass = false) { |
|
184 | 184 | return $this->buildAndModify($config, $this->getReplyHandlerArguments($config), $defaultClass); |
185 | 185 | } |
186 | 186 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @param string $defaultClass the class to use if none is set in config. |
194 | 194 | * @return object the service-activator instance |
195 | 195 | */ |
196 | - public function createServiceActivator($config, $defaultClass = false){ |
|
196 | + public function createServiceActivator($config, $defaultClass = false) { |
|
197 | 197 | $method = (string)$config['method']; |
198 | 198 | $service = $this->context->getServiceProvider()->provideService((string)$config['ref']); |
199 | - if($method && $service){ |
|
199 | + if ($method && $service) { |
|
200 | 200 | $args = $this->getReplyHandlerArguments($config); |
201 | - array_unshift($args,array( |
|
201 | + array_unshift($args, array( |
|
202 | 202 | $service, |
203 | 203 | $method |
204 | 204 | )); |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @param object $config configuration object to create arguments from. |
216 | 216 | * @return mixed build arguments |
217 | 217 | */ |
218 | - protected function getReplyHandlerArguments($config){ |
|
218 | + protected function getReplyHandlerArguments($config) { |
|
219 | 219 | $args = array( |
220 | 220 | $this->doGetChannel('input', $config), |
221 | 221 | $this->doGetChannel('output', $config) |
222 | 222 | ); |
223 | - if($args[0] == NULL){ |
|
223 | + if ($args[0] == NULL) { |
|
224 | 224 | throw new \RuntimeException('Could not receive input channel.'); |
225 | 225 | } |
226 | 226 | return $args; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param object $config configuration object to return request-channel from. |
236 | 236 | * @return \PEIP\INF\Channel\Channel request-channel |
237 | 237 | */ |
238 | - protected function getRequestChannel($config){ |
|
238 | + protected function getRequestChannel($config) { |
|
239 | 239 | return $this->doGetChannel('request', $config); |
240 | 240 | } |
241 | 241 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param object $config configuration object to return reply-channel from. |
249 | 249 | * @return \PEIP\INF\Channel\Channel reply-channel |
250 | 250 | */ |
251 | - protected function getReplyChannel($config){ |
|
251 | + protected function getReplyChannel($config) { |
|
252 | 252 | return $this->doGetChannel('reply', $config); |
253 | 253 | } |
254 | 254 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param object $config configuration object to return channel from. |
262 | 262 | * @return \PEIP\INF\Channel\Channel reply-channel |
263 | 263 | */ |
264 | - public function doGetChannel($type, $config){ |
|
264 | + public function doGetChannel($type, $config) { |
|
265 | 265 | $channelName = isset($config[$type."_channel"]) |
266 | 266 | ? $config[$type."_channel"] |
267 | 267 | : $config["default_".$type."_channel"]; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param mixed $value the value to store |
35 | 35 | * @return |
36 | 36 | */ |
37 | - public function setValue($key, $value){ |
|
37 | + public function setValue($key, $value) { |
|
38 | 38 | return $this->offsetSet($key, $value); |
39 | 39 | } |
40 | 40 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param mixed $key the key to return value for |
46 | 46 | * @return mixed the value for the given key |
47 | 47 | */ |
48 | - public function getValue($key){ |
|
48 | + public function getValue($key) { |
|
49 | 49 | return $this->offsetGet($key, $value); |
50 | 50 | } |
51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param mixed $key the key to unset value for |
57 | 57 | * @return |
58 | 58 | */ |
59 | - public function deleteValue($key){ |
|
59 | + public function deleteValue($key) { |
|
60 | 60 | return $this->offsetUnset($key); |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param mixed $key the key to look for a value |
68 | 68 | * @return boolean wether a value is stored for the key |
69 | 69 | */ |
70 | - public function hasValue($key){ |
|
70 | + public function hasValue($key) { |
|
71 | 71 | return $this->offsetExists($key); |
72 | 72 | } |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param array $values key/value pairs to store |
79 | 79 | * @return |
80 | 80 | */ |
81 | - public function setValues(array $values){ |
|
81 | + public function setValues(array $values) { |
|
82 | 82 | $this->values = $values; |
83 | 83 | } |
84 | 84 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @access public |
89 | 89 | * @return array stored key/value pairs |
90 | 90 | */ |
91 | - public function getValues(){ |
|
91 | + public function getValues() { |
|
92 | 92 | return $this->values; |
93 | 93 | } |
94 | 94 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param $values |
101 | 101 | * @return |
102 | 102 | */ |
103 | - public function addValues(array $values){ |
|
103 | + public function addValues(array $values) { |
|
104 | 104 | array_merge($this->values, $values); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | \ No newline at end of file |