@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param $name |
34 | 34 | * @return |
35 | 35 | */ |
36 | - public static function getInstance(){ |
|
36 | + public static function getInstance() { |
|
37 | 37 | return self::$instance ? self::$instance : self::$instance = new ChannelRegistry; |
38 | 38 | } |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param $channel |
44 | 44 | * @return |
45 | 45 | */ |
46 | - public function register($channel){ |
|
46 | + public function register($channel) { |
|
47 | 47 | $this->channels[$channel->getName()] = $channel; |
48 | 48 | } |
49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param $name |
56 | 56 | * @return |
57 | 57 | */ |
58 | - public function get($name){ |
|
58 | + public function get($name) { |
|
59 | 59 | return $this->channels[$name]; |
60 | 60 | } |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param $channelName |
66 | 66 | * @return |
67 | 67 | */ |
68 | - public function resolveChannelName($channelName){ |
|
68 | + public function resolveChannelName($channelName) { |
|
69 | 69 | return $this->get($channelName); |
70 | 70 | } |
71 | 71 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param \PEIP\INF\Message\Message $message the message to send |
42 | 42 | * @return |
43 | 43 | */ |
44 | - protected function doSend(\PEIP\INF\Message\Message $message){ |
|
44 | + protected function doSend(\PEIP\INF\Message\Message $message) { |
|
45 | 45 | $this->messages[] = $message; |
46 | 46 | return true; |
47 | 47 | } |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | * @param integer $timeout timout for receiving a message |
56 | 56 | * @return |
57 | 57 | */ |
58 | - public function receive($timeout = 0){ |
|
58 | + public function receive($timeout = 0) { |
|
59 | 59 | $this->doFireEvent(self::EVENT_PRE_RECEIVE); |
60 | 60 | $message = NULL; |
61 | - if($timeout == 0){ |
|
61 | + if ($timeout == 0) { |
|
62 | 62 | $message = $this->getMessage(); |
63 | - }elseif($timeout < 0){ |
|
64 | - while(!$message = $this->getMessage()){ |
|
63 | + }elseif ($timeout < 0) { |
|
64 | + while (!$message = $this->getMessage()) { |
|
65 | 65 | |
66 | 66 | } |
67 | - }else{ |
|
67 | + }else { |
|
68 | 68 | $time = time() + $timeout; |
69 | - while(($time > time()) && !$message = $this->getMessage()){ |
|
69 | + while (($time > time()) && !$message = $this->getMessage()) { |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @access protected |
85 | 85 | * @return \PEIP\INF\Message\Message message from top of the message stack |
86 | 86 | */ |
87 | - protected function getMessage(){ |
|
87 | + protected function getMessage() { |
|
88 | 88 | return array_shift($this->messages); |
89 | 89 | } |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @access public |
95 | 95 | * @return |
96 | 96 | */ |
97 | - public function clear(){ |
|
97 | + public function clear() { |
|
98 | 98 | $this->messages = array(); |
99 | 99 | } |
100 | 100 | |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | * @param \PEIP\INF\Message\Message_Selector $selector the selector to accept messages |
106 | 106 | * @return array accepted messages |
107 | 107 | */ |
108 | - public function purge(\PEIP\INF\Selector\MessageSelector $selector){ |
|
109 | - foreach($this->messages as $key=>$message){ |
|
110 | - if(!$selector->acceptMessage($message)){ |
|
108 | + public function purge(\PEIP\INF\Selector\MessageSelector $selector) { |
|
109 | + foreach ($this->messages as $key=>$message) { |
|
110 | + if (!$selector->acceptMessage($message)) { |
|
111 | 111 | unset($this->messages[$key]); |
112 | 112 | } |
113 | 113 | } |
@@ -60,11 +60,11 @@ |
||
60 | 60 | $message = NULL; |
61 | 61 | if($timeout == 0){ |
62 | 62 | $message = $this->getMessage(); |
63 | - }elseif($timeout < 0){ |
|
63 | + } elseif($timeout < 0){ |
|
64 | 64 | while(!$message = $this->getMessage()){ |
65 | 65 | |
66 | 66 | } |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | $time = time() + $timeout; |
69 | 69 | while(($time > time()) && !$message = $this->getMessage()){ |
70 | 70 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @access public |
29 | 29 | * @return |
30 | 30 | */ |
31 | - public function getName(){ |
|
31 | + public function getName() { |
|
32 | 32 | |
33 | 33 | } |
34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param $timeout |
41 | 41 | * @return |
42 | 42 | */ |
43 | - public function send(\PEIP\INF\Message\Message $message, $timeout = -1){ |
|
43 | + public function send(\PEIP\INF\Message\Message $message, $timeout = -1) { |
|
44 | 44 | |
45 | 45 | } |
46 | 46 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param $timeout |
37 | 37 | * @return |
38 | 38 | */ |
39 | - public function send(\PEIP\INF\Message\Message $message, $timeout = -1){ |
|
39 | + public function send(\PEIP\INF\Message\Message $message, $timeout = -1) { |
|
40 | 40 | |
41 | 41 | $sent = $this->doSend($message); |
42 | 42 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param $message |
50 | 50 | * @return |
51 | 51 | */ |
52 | - protected function doSend(\PEIP\INF\Message\Message $message){ |
|
52 | + protected function doSend(\PEIP\INF\Message\Message $message) { |
|
53 | 53 | $this->getMessageDispatcher()->notify($message); |
54 | 54 | return true; |
55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @access public |
60 | 60 | * @return |
61 | 61 | */ |
62 | - public function getMessageDispatcher(){ |
|
62 | + public function getMessageDispatcher() { |
|
63 | 63 | return isset($this->dispatcher) ? $this->dispatcher : $this->dispatcher = new IteratingDispatcher; |
64 | 64 | } |
65 | 65 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * @param $message |
38 | 38 | * @return |
39 | 39 | */ |
40 | - protected function doSend(\PEIP\INF\Message\Message $message){ |
|
40 | + protected function doSend(\PEIP\INF\Message\Message $message) { |
|
41 | 41 | $this->doFireEvent('prePublish', array('MESSAGE'=>$message)); |
42 | 42 | $this->getMessageDispatcher()->notify($message); |
43 | 43 | $this->doFireEvent('postPublish', array('MESSAGE'=>$message)); |
@@ -9,22 +9,22 @@ |
||
9 | 9 | protected $channel; |
10 | 10 | protected $handler; |
11 | 11 | |
12 | - public function __construct(\PEIP\ABS\Handler\MessageHandler $handler, $channel){ |
|
12 | + public function __construct(\PEIP\ABS\Handler\MessageHandler $handler, $channel) { |
|
13 | 13 | $this->channel = $channel; |
14 | 14 | $this->handler = $handler; |
15 | 15 | } |
16 | 16 | |
17 | - protected function getMessage($object){ |
|
18 | - if($this->channel instanceof \PEIP\INF\Channel\SubscribableChannel){ |
|
17 | + protected function getMessage($object) { |
|
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 | } |
24 | 24 | |
25 | - public function handle($object){ |
|
25 | + public function handle($object) { |
|
26 | 26 | $message = $this->getMessage($object); |
27 | - if(!is_object($message)){ |
|
27 | + if (!is_object($message)) { |
|
28 | 28 | throw new \Exception('Could not get Message from Channel'); |
29 | 29 | } |
30 | 30 | $this->handler->handle($message); |
@@ -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 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @param $params |
35 | 35 | * @return |
36 | 36 | */ |
37 | - public function __construct($callable, array $params = array()){ |
|
37 | + public function __construct($callable, array $params = array()) { |
|
38 | 38 | $this->callable = $callable; |
39 | 39 | $this->setParameters($params); |
40 | 40 | } |
@@ -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 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setParameters($namespace, array $parameters){ |
76 | 76 | $this->getParameterHolderOrCreate($namespace)->setParameters($parameters); |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function addParameters($namespace, array $parameters){ |
87 | 87 | $this->getParameterHolderOrCreate($namespace)->addParameters($parameters); |
88 | - } |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function getParameters($namespace){ |
104 | 104 | $this->getParameterHolderOrCreate($namespace)->getParameters(); |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | 107 | |
108 | 108 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getParameter($namespace, $name){ |
115 | 115 | $this->getParameterHolderOrCreate($namespace)->getParameter($name); |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | 118 | |
119 | 119 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function setParameter($namespace, $name, $value){ |
127 | 127 | $this->getParameterHolderOrCreate($namespace)->setParameters($parameters); |
128 | - } |
|
128 | + } |
|
129 | 129 | |
130 | 130 | |
131 | 131 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function hasParameter($namespace, $name){ |
138 | 138 | $this->getParameterHolderOrCreate($namespace)->hasParameter($name); |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | |
142 | 142 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function deleteParameter($namespace, $name){ |
149 | 149 | $this->getParameterHolderOrCreate($namespace)->setParameters($parameters); |
150 | - } |
|
150 | + } |
|
151 | 151 | |
152 | 152 | |
153 | 153 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder){ |
168 | 168 | $this->stores[$namespace] = $holder; |
169 | - } |
|
169 | + } |
|
170 | 170 | |
171 | 171 | |
172 | 172 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function getParameterHolder($namespace){ |
185 | 185 | return $this->stores[$namespace]; |
186 | - } |
|
186 | + } |
|
187 | 187 | |
188 | 188 | |
189 | 189 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function hasParameterHolder($namespace){ |
202 | 202 | return array_key_exists($namespace, $this->stores); |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | 206 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function deleteParameterHolder($namespace){ |
219 | 219 | unset($this->stores[$namespace]); |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | 222 | |
223 | 223 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param $factory |
36 | 36 | * @return |
37 | 37 | */ |
38 | - public function __construct(\PEIP\INF\Factory\DedicatedFactory $factory){ |
|
38 | + public function __construct(\PEIP\INF\Factory\DedicatedFactory $factory) { |
|
39 | 39 | $this->factory = $factory; |
40 | 40 | } |
41 | 41 | |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * @param $namespace |
46 | 46 | * @return |
47 | 47 | */ |
48 | - protected function getParameterHolderOrCreate($namespace){ |
|
49 | - if(!$this->hasParameterHolder($namespace)){ |
|
48 | + protected function getParameterHolderOrCreate($namespace) { |
|
49 | + if (!$this->hasParameterHolder($namespace)) { |
|
50 | 50 | $store = $this->factory->build(); |
51 | - if($store instanceof \PEIP\INF\Data\ParameterHolder){ |
|
51 | + if ($store instanceof \PEIP\INF\Data\ParameterHolder) { |
|
52 | 52 | $this->stores[$namespace] = $store; |
53 | - }else{ |
|
53 | + }else { |
|
54 | 54 | throw new \Exception('Could not build Instance of \PEIP\INF\Data\ParameterHolder from factory.'); |
55 | 55 | } |
56 | 56 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param $value |
73 | 73 | * @return |
74 | 74 | */ |
75 | - public function setParameters($namespace, array $parameters){ |
|
75 | + public function setParameters($namespace, array $parameters) { |
|
76 | 76 | $this->getParameterHolderOrCreate($namespace)->setParameters($parameters); |
77 | 77 | } |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param $parameters |
84 | 84 | * @return |
85 | 85 | */ |
86 | - public function addParameters($namespace, array $parameters){ |
|
86 | + public function addParameters($namespace, array $parameters) { |
|
87 | 87 | $this->getParameterHolderOrCreate($namespace)->addParameters($parameters); |
88 | 88 | } |
89 | 89 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param $name |
101 | 101 | * @return |
102 | 102 | */ |
103 | - public function getParameters($namespace){ |
|
103 | + public function getParameters($namespace) { |
|
104 | 104 | $this->getParameterHolderOrCreate($namespace)->getParameters(); |
105 | 105 | } |
106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param $name |
112 | 112 | * @return |
113 | 113 | */ |
114 | - public function getParameter($namespace, $name){ |
|
114 | + public function getParameter($namespace, $name) { |
|
115 | 115 | $this->getParameterHolderOrCreate($namespace)->getParameter($name); |
116 | 116 | } |
117 | 117 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param $value |
124 | 124 | * @return |
125 | 125 | */ |
126 | - public function setParameter($namespace, $name, $value){ |
|
126 | + public function setParameter($namespace, $name, $value) { |
|
127 | 127 | $this->getParameterHolderOrCreate($namespace)->setParameters($parameters); |
128 | 128 | } |
129 | 129 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param $name |
135 | 135 | * @return |
136 | 136 | */ |
137 | - public function hasParameter($namespace, $name){ |
|
137 | + public function hasParameter($namespace, $name) { |
|
138 | 138 | $this->getParameterHolderOrCreate($namespace)->hasParameter($name); |
139 | 139 | } |
140 | 140 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param $name |
146 | 146 | * @return |
147 | 147 | */ |
148 | - public function deleteParameter($namespace, $name){ |
|
148 | + public function deleteParameter($namespace, $name) { |
|
149 | 149 | $this->getParameterHolderOrCreate($namespace)->setParameters($parameters); |
150 | 150 | } |
151 | 151 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param $holder |
165 | 165 | * @return |
166 | 166 | */ |
167 | - public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder){ |
|
167 | + public function setParameterHolder($namespace, \PEIP\INF\Data\ParameterHolder $holder) { |
|
168 | 168 | $this->stores[$namespace] = $holder; |
169 | 169 | } |
170 | 170 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param $namespace |
182 | 182 | * @return |
183 | 183 | */ |
184 | - public function getParameterHolder($namespace){ |
|
184 | + public function getParameterHolder($namespace) { |
|
185 | 185 | return $this->stores[$namespace]; |
186 | 186 | } |
187 | 187 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param $namespace |
199 | 199 | * @return |
200 | 200 | */ |
201 | - public function hasParameterHolder($namespace){ |
|
201 | + public function hasParameterHolder($namespace) { |
|
202 | 202 | return array_key_exists($namespace, $this->stores); |
203 | 203 | } |
204 | 204 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param $namespace |
216 | 216 | * @return |
217 | 217 | */ |
218 | - public function deleteParameterHolder($namespace){ |
|
218 | + public function deleteParameterHolder($namespace) { |
|
219 | 219 | unset($this->stores[$namespace]); |
220 | 220 | } |
221 | 221 |
@@ -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 | } |