Completed
Push — v1.ns ( ab319d...410f3f )
by Timo
04:00
created
src/Base/DynamicAdapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param $subject 
37 37
      * @return 
38 38
      */
39
-    public function __construct(\ArrayAccess $methodMap, $subject){
39
+    public function __construct(\ArrayAccess $methodMap, $subject) {
40 40
         $this->methodMap = $methodMap;
41 41
         $this->subject = $subject;      
42 42
     }
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
      * @param $arguments 
49 49
      * @return 
50 50
      */
51
-    public function __call($method, array $arguments){
52
-        if(array_key_exists($method, $this->methodMap)){
51
+    public function __call($method, array $arguments) {
52
+        if (array_key_exists($method, $this->methodMap)) {
53 53
             return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments);
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
src/Base/FlyAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param $methodMap 
31 31
      * @return 
32 32
      */
33
-    public function __construct(ArrayAccess $methodMap){        
33
+    public function __construct(ArrayAccess $methodMap) {        
34 34
         $this->methodMap = $methodMap;  
35 35
     }
36 36
     
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param $subject 
41 41
      * @return 
42 42
      */
43
-    public function setSubject($subject){
43
+    public function setSubject($subject) {
44 44
         $this->subject = $subject;
45 45
         return $this;
46 46
     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      * @param $arguments 
53 53
      * @return 
54 54
      */
55
-    public function __call($method, $arguments){
56
-        if(array_key_exists($method, $this->methodMap)){
55
+    public function __call($method, $arguments) {
56
+        if (array_key_exists($method, $this->methodMap)) {
57 57
             return call_user_func_array(array($this->subject, $this->methodMap[$method]), $arguments);
58 58
         }
59 59
     }
Please login to merge, or discard this patch.
src/Gateway/SimpleMessagingGateway.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway
43 43
      * @param array $defaultHeaders The default headers to apply to request messages 
44 44
      */
45
-    public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()){
45
+    public function __construct(\PEIP\INF\Channel\Channel $requestChannel, \PEIP\INF\Channel\Channel $replyChannel = NULL, array $defaultHeaders = array()) {
46 46
         $this->setRequestChannel($requestChannel);
47
-        if($replyChannel){
47
+        if ($replyChannel) {
48 48
             $this->setReplyChannel($replyChannel);
49 49
         }     
50 50
         $this->defaultHeaders = $defaultHeaders;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param \PEIP\INF\Channel\Channel $replyChannel The default channel to receive requests from the gateway
59 59
      * @return 
60 60
      */
61
-    public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel){
61
+    public function setRequestChannel(\PEIP\INF\Channel\Channel $requestChannel) {
62 62
         $this->requestChannel = $requestChannel;
63 63
     }
64 64
   
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
      * @param \PEIP\INF\Channel\PollableChannel $replyChannel The default channel to receive requests from the gateway
70 70
      * @return 
71 71
      */
72
-    public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel){
73
-        if(!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)){
72
+    public function setReplyChannel(\PEIP\INF\Channel\Channel $replyChannel) {
73
+        if (!($replyChannel instanceof \PEIP\INF\Channel\PollableChannel)) {
74 74
             throw new \InvalidArgumentException('reply channel must be instance of \PEIP\INF\Channel\PollableChannel.');
75 75
         }       
76 76
         $this->replyChannel = $replyChannel;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param mixed $content the content/payload for the message to send 
84 84
      * @return 
85 85
      */
86
-    public function send($content){
86
+    public function send($content) {
87 87
         return $this->requestChannel->send($this->buildMessage($content));
88 88
     }
89 89
    
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
      * @access public
94 94
      * @return mixed content/payload of the received message
95 95
      */
96
-    public function receive(){
97
-        if(!isset($this->replyChannel)){
96
+    public function receive() {
97
+        if (!isset($this->replyChannel)) {
98 98
             throw new \LogicException('No replyChannel set.');
99 99
         }       
100 100
         $message = $this->replyChannel->receive();
101
-        if($message){
101
+        if ($message) {
102 102
             return $message->getContent();
103 103
         }
104 104
         return NULL;
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
      * @param mixed $content the content/payload for the message to send 
112 112
      * @return mixed content/payload of the received message
113 113
      */
114
-    public function sendAndReceive($content){
114
+    public function sendAndReceive($content) {
115 115
         $this->send($content);
116 116
         try {
117 117
             $res = $this->receive();
118 118
         }
119
-        catch(\Exception $e){
119
+        catch (\Exception $e) {
120 120
             return NULL;
121 121
         }
122 122
         return $res;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param mixed $content the content/payload for the message to send 
130 130
      * @return \PEIP\INF\Message\Message the built message
131 131
      */
132
-    protected function buildMessage($content){
132
+    protected function buildMessage($content) {
133 133
         return $this->getMessageBuilder()->setContent($content)->build();   
134 134
     }   
135 135
       
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @access protected
140 140
      * @return MessageBuilder message builder instance for the registerd message class
141 141
      */
142
-    protected function getMessageBuilder(){
142
+    protected function getMessageBuilder() {
143 143
         return isset($this->messageBuilder) && ($this->messageBuilder->getMessageClass() == $this->getMessageClass())
144 144
             ? $this->messageBuilder
145 145
             : $this->messageBuilder = MessageBuilder::getInstance($this->messageClass)->setHeaders($this->defaultHeaders);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param   string $messageClass message class to create instances from
153 153
      * @return 
154 154
      */
155
-    public function setMessageClass($messageClass){
155
+    public function setMessageClass($messageClass) {
156 156
         $this->messageClass = $messageClass;
157 157
     }
158 158
     
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @access public
163 163
      * @return string message class to create instances from
164 164
      */
165
-    public function getMessageClass(){
165
+    public function getMessageClass() {
166 166
         return $this->messageClass;
167 167
     }   
168 168
 
Please login to merge, or discard this patch.
src/Selector/ContentClassSelector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param $className 
34 34
      * @return 
35 35
      */
36
-    public function __construct($className){
36
+    public function __construct($className) {
37 37
         $this->className = $className;
38 38
     }       
39 39
             
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param $message 
44 44
      * @return 
45 45
      */
46
-    public function acceptMessage(\PEIP\INF\Message\Message $message){
46
+    public function acceptMessage(\PEIP\INF\Message\Message $message) {
47 47
         return $message->getContent() instanceof $className;
48 48
     }           
49 49
     
Please login to merge, or discard this patch.
src/Selector/ContentTypeSelector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     
Please login to merge, or discard this patch.
src/Command/Command.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Service/ServiceProvider.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use PEIP\Context\XMLContext;
15 15
 use PEIP\Plugins\BasePlugin;
16 16
 
17
-class ServiceProvider extends \PEIP\Service\ServiceContainer  {
17
+class ServiceProvider extends \PEIP\Service\ServiceContainer {
18 18
 
19 19
     const
20 20
         /* Headers */
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function  __construct(array $config = array(), $idAttribute = 'id') {
48 48
         $this->idAttribute = $idAttribute;
49 49
         $this->initNodeBuilders();
50
-        foreach($config as $serviceConfig){
50
+        foreach ($config as $serviceConfig) {
51 51
             $this->addConfig($serviceConfig);
52 52
         }
53 53
         
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @access public
59 59
      * @return array registered services
60 60
      */
61
-    public function getServices(){
61
+    public function getServices() {
62 62
         return $this->services;
63 63
     }
64 64
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param string $nodeName the name of the node
71 71
      * @param callable $callable a callable which creates instances for node-name
72 72
      */
73
-    public function registerNodeBuilder($nodeName, $callable){
73
+    public function registerNodeBuilder($nodeName, $callable) {
74 74
         $this->nodeBuilders[$nodeName] = $callable;
75 75
     }
76 76
   /**
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
      * @see XMLContext::includeContext
84 84
      * @access protected
85 85
      */
86
-    protected function initNodeBuilders(){
86
+    protected function initNodeBuilders() {
87 87
         $builders = array(
88 88
             'service' => 'initService'
89 89
         );
90
-        foreach($builders as $nodeName => $method){
90
+        foreach ($builders as $nodeName => $method) {
91 91
            $this->registerNodeBuilder($nodeName, array($this, $method));
92 92
         }
93 93
     }
94 94
 
95
-    public function addConfig($config){ 
95
+    public function addConfig($config) { 
96 96
         $this->doFireEvent(
97 97
             self::EVENT_BEFORE_ADD_CONFIG,
98 98
             array(
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
         );
112 112
     }
113 113
 
114
-    public function provideService($key){
114
+    public function provideService($key) {
115 115
         $this->doFireEvent(self::EVENT_BEFORE_PROVIDE_SERVICE, array(
116 116
             self::HEADER_KEY=>$key)
117 117
         );
118 118
 
119
-        if($this->hasService($key)){
120
-            $service =  $this->getService($key);
121
-        }else{
122
-            $service =  $this->createService($key);
119
+        if ($this->hasService($key)) {
120
+            $service = $this->getService($key);
121
+        }else {
122
+            $service = $this->createService($key);
123 123
         }
124 124
 
125 125
         $this->doFireEvent(self::EVENT_AFTER_PROVIDE_SERVICE, array(
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
         return $service;
131 131
     }
132 132
 
133
-    protected function createService($key){
133
+    protected function createService($key) {
134 134
         $this->doFireEvent(self::EVENT_BEFORE_CREATE_SERVICE, array(
135 135
             self::HEADER_KEY=>$key)
136 136
         );
137 137
         $errorMessage = '';
138 138
         $config = $this->getServiceConfig($key);
139 139
 
140
-        if($config){
140
+        if ($config) {
141 141
             $node = $this->buildNode($config);
142
-            if($node){
142
+            if ($node) {
143 143
                 $this->setService(
144 144
                     $key,
145 145
                     $node
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
                 ));
151 151
 
152 152
                 return $node;                
153
-            }else{
153
+            }else {
154 154
                 $errorMessage = 'COULD NOT BUILD NODE FOR KEY: '.$key;
155 155
             }
156 156
 
157
-        }else{
157
+        }else {
158 158
             $errorMessage = 'NO CONFIG FOR KEY: '.$key;
159 159
         }
160 160
         $this->doFireEvent(self::EVENT_CREATE_SERVICE_ERROR, array(
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
         return NULL;
165 165
     }
166 166
 
167
-    public function getServiceConfig($key){
168
-        if(!isset($this->ids[$key])){
167
+    public function getServiceConfig($key) {
168
+        if (!isset($this->ids[$key])) {
169 169
             return false;
170 170
         }
171 171
         return $this->config[$this->ids[$key]];
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @param object $config configuration-node
181 181
      * @return void
182 182
      */
183
-    protected function buildNode($config){
183
+    protected function buildNode($config) {
184 184
         $nodeName = (string)$config['type'];
185 185
 
186 186
         $this->doFireEvent(self::EVENT_BEFORE_BUILD_NODE, array(
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
             self::HEADER_NODE_NAME=> $nodeName
189 189
         ));
190 190
         // call the builder method registered for the node.
191
-        if(array_key_exists($nodeName, $this->nodeBuilders)){
191
+        if (array_key_exists($nodeName, $this->nodeBuilders)) {
192 192
 
193 193
             $nodeInstance = call_user_func($this->nodeBuilders[$nodeName], $config);
194
-            if(is_object($nodeInstance)){
194
+            if (is_object($nodeInstance)) {
195 195
                 $this->doFireEvent(self::EVENT_BUILD_NODE_SUCCESS, array(
196 196
                     self::HEADER_NODE_CONFIG=>$config,
197 197
                     self::HEADER_NODE_NAME=> $nodeName,
198 198
                     self::HEADER_NODE => $nodeInstance
199 199
                 ));
200 200
                 return $nodeInstance;
201
-            }else{
201
+            }else {
202 202
                 $errorMessage = 'BUILDER RETURNED NO OBJECT FOR NODE-TYPE: '.$nodeName;
203 203
             }
204
-        }else{
204
+        }else {
205 205
             $errorMessage = 'NO BUILDER FOUND FOR NODE-TYPE: '.$nodeName;
206 206
         }
207 207
 
@@ -212,27 +212,27 @@  discard block
 block discarded – undo
212 212
         ));
213 213
     }
214 214
 
215
-    protected function getIdFromConfig($config){
215
+    protected function getIdFromConfig($config) {
216 216
         $id = '';
217
-        if(isset($config[$this->idAttribute])){
217
+        if (isset($config[$this->idAttribute])) {
218 218
             $id = trim((string)($config[$this->idAttribute]));
219 219
         }
220 220
         return $id;
221 221
     }
222 222
 
223
-    protected function getCountConfig(){
223
+    protected function getCountConfig() {
224 224
         return count($this->config);
225 225
     }
226 226
 
227
-    protected function doAddConfig($config){
227
+    protected function doAddConfig($config) {
228 228
         $countConfig = $this->getCountConfig();
229 229
         $this->config[$countConfig] = $config;
230 230
         return $countConfig;
231 231
     }
232 232
 
233
-    protected function doRegisterConfig($config){
234
-        $id  = $this->getIdFromConfig($config);
235
-        if($id != ''){
233
+    protected function doRegisterConfig($config) {
234
+        $id = $this->getIdFromConfig($config);
235
+        if ($id != '') {
236 236
             $this->ids[$id] = $this->getCountConfig() - 1;
237 237
         }
238 238
         return $id;
Please login to merge, or discard this patch.
src/Service/ServiceActivator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
      * @param $outputChannel 
34 34
      * @return 
35 35
      */
36
-    public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){
36
+    public function __construct($serviceCallable, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
37 37
         $this->serviceCallable = $serviceCallable;
38
-        if(is_object($inputChannel)){
38
+        if (is_object($inputChannel)) {
39 39
             $this->setInputChannel($inputChannel);
40 40
         }
41
-        if(is_object($outputChannel)){
41
+        if (is_object($outputChannel)) {
42 42
             $this->setOutputChannel($outputChannel);    
43 43
         }   
44 44
     }       
Please login to merge, or discard this patch.
src/Service/SplittingServiceActivator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@
 block discarded – undo
33 33
      * @param \PEIP\INF\Message\Message $message message to call the service with it�s content/payload
34 34
      * @return mixed result of calling the registered service callable with message content/payload
35 35
      */
36
-    public function callService(\PEIP\INF\Message\Message $message){
37
-        if(is_callable($this->serviceCallable)){
36
+    public function callService(\PEIP\INF\Message\Message $message) {
37
+        if (is_callable($this->serviceCallable)) {
38 38
             $res = call_user_func_array($this->serviceCallable, $message->getContent());
39
-        }elseif(is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')){
39
+        }elseif (is_object($this->serviceCallable) && method_exists($this->serviceCallable, 'handle')) {
40 40
             $res = call_user_func_array(array($this->serviceCallable, 'handle'), $message->getContent());               
41 41
         }
42 42
         return $res;
Please login to merge, or discard this patch.