Completed
Push — v1.ns ( ff674e...64f725 )
by Timo
03:35
created
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.
src/Service/ServiceContainerBuilder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 use \PEIP\Data\InternalStoreAbstract;
26 26
 use PEIP\Factory\DedicatedFactory;
27 27
 
28
-class ServiceContainerBuilder extends \PEIP\Data\InternalStoreAbstract{
28
+class ServiceContainerBuilder extends \PEIP\Data\InternalStoreAbstract {
29 29
     
30 30
     
31 31
     
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param $factory 
36 36
      * @return 
37 37
      */
38
-    public function setFactory($key, DedicatedFactory $factory){
38
+    public function setFactory($key, DedicatedFactory $factory) {
39 39
             $this->setInternalValue($key, $factory);
40 40
     }
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param $key 
46 46
      * @return 
47 47
      */
48
-    public function getFactory($key){
48
+    public function getFactory($key) {
49 49
             $this->getInternalValue($key);
50 50
     }
51 51
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param $key 
56 56
      * @return 
57 57
      */
58
-    public function hasFactory($key){
58
+    public function hasFactory($key) {
59 59
             $this->hasInternalValue($key);
60 60
     }
61 61
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param $key 
66 66
      * @return 
67 67
      */
68
-    public function deleteFactory($key){
68
+    public function deleteFactory($key) {
69 69
             $this->deleteInternalValue($key);
70 70
     }
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param $key 
76 76
      * @return 
77 77
      */
78
-    public function getService($key){
78
+    public function getService($key) {
79 79
         return isset($this->services[$key]) ? $this->services[$key] : $this->services[$key] = $this->getFactory($key)->build();
80 80
     }
81 81
     
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param $key 
87 87
      * @return 
88 88
      */
89
-    public function buildService($key){
89
+    public function buildService($key) {
90 90
         return $this->getFactory($key)->build();
91 91
     }   
92 92
     
Please login to merge, or discard this patch.
src/Service/ServiceContainer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 class ServiceContainer
28 28
     extends \PEIP\ABS\Base\Connectable
29 29
     implements 
30
-        \PEIP\INF\Service\ServiceContainer{
30
+        \PEIP\INF\Service\ServiceContainer {
31 31
 
32 32
     protected $services = array();
33 33
     
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param $service 
46 46
      * @return 
47 47
      */
48
-    public function setService($key, $service){
48
+    public function setService($key, $service) {
49 49
         $this->services[$key] = $service;
50 50
     }
51 51
     
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param $key 
56 56
      * @return 
57 57
      */
58
-    public function getService($key){
58
+    public function getService($key) {
59 59
         return $this->services[$key];
60 60
     }
61 61
     
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param $key 
66 66
      * @return 
67 67
      */
68
-    public function hasService($key){
68
+    public function hasService($key) {
69 69
         return array_key_exists($key, $this->services); 
70 70
     }   
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param $key 
76 76
      * @return 
77 77
      */
78
-    public function deleteService($key){
78
+    public function deleteService($key) {
79 79
         unset($this->services[$key]);
80 80
     }
81 81
     
Please login to merge, or discard this patch.
src/Service/HeaderServiceActivator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @author timo
13 13
  */
14 14
 
15
-class HeaderServiceActivator extends \PEIP\Service\ServiceActivator{
15
+class HeaderServiceActivator extends \PEIP\Service\ServiceActivator {
16 16
    
17 17
     protected $headerName;
18 18
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      * @param $outputChannel
25 25
      * @return
26 26
      */
27
-    public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL){
27
+    public function __construct($serviceCallable, $headerName, \PEIP\INF\Channel\Channel $inputChannel = NULL, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
28 28
         $this->headerName = $headerName;
29 29
         parent::__construct($serviceCallable, $inputChannel, $outputChannel);
30 30
     }
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/INF/Message/MessageDispatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
 
27 27
   public function disconnect($name, \PEIP\INF\Message\MessageHandler $handler);
28 28
 
29
-  public function notify( $event);
29
+  public function notify($event);
30 30
 
31
-  public function notifyUntil( $event);
31
+  public function notifyUntil($event);
32 32
 
33
-  public function filter( $event, $value);
33
+  public function filter($event, $value);
34 34
 
35 35
   public function hasListeners($name);
36 36
 
Please login to merge, or discard this patch.
src/INF/Dispatcher/ListDispatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
 
25 25
 interface ListDispatcher extends \PEIP\INF\Dispatcher\Dispatcher {
26 26
 
27
-  public function connect( $handler);
27
+  public function connect($handler);
28 28
 
29
-  public function disconnect( $handler);
29
+  public function disconnect($handler);
30 30
 
31 31
   public function hasListeners();
32 32
 
Please login to merge, or discard this patch.
src/Listener/Wiretap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
      * @param $outputChannel 
34 34
      * @return 
35 35
      */
36
-    public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL){
36
+    public function __construct(\PEIP\INF\Channel\Channel $inputChannel, \PEIP\INF\Channel\Channel $outputChannel = NULL) {
37 37
         $this->setEventName('preSend');
38 38
         $this->setInputChannel($inputChannel);
39
-        if(is_object($outputChannel)){
39
+        if (is_object($outputChannel)) {
40 40
             $this->setOutputChannel($outputChannel);
41 41
         }           
42 42
     }           
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param $message 
48 48
      * @return 
49 49
      */
50
-    protected function doReply(\PEIP\INF\Message\Message $message){
50
+    protected function doReply(\PEIP\INF\Message\Message $message) {
51 51
         $this->replyMessage($message->getHeader('MESSAGE'));
52 52
     }
53 53
     
Please login to merge, or discard this patch.