Completed
Push — v1.ns ( f9750b...3d0401 )
by Timo
03:19
created
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/INF/Base/Singleton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,6 +22,6 @@
 block discarded – undo
22 22
 
23 23
 interface Singleton {
24 24
 
25
-    public static function getInstance ();
25
+    public static function getInstance();
26 26
 
27 27
 }
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/Handler/CallableHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param callable $callable the callable to wrap with the handler 
34 34
      * @return 
35 35
      */
36
-    public function __construct($callable){
36
+    public function __construct($callable) {
37 37
         $this->callable = $callable;    
38 38
     }
39 39
         
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param mixed $subject the subject to handle
46 46
      * @return mixed result of calling the registered callable with given subject
47 47
      */
48
-    public function handle($subject){
48
+    public function handle($subject) {
49 49
         return call_user_func($this->callable, $subject);
50 50
     }
51 51
     
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @return mixed result of calling the registered callable with given subject
59 59
      * @see CallableHandler::handle 
60 60
      */
61
-    public function __invoke($subject){
61
+    public function __invoke($subject) {
62 62
         return $this->handle($subject); 
63 63
     }
64 64
     
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @access public
69 69
      * @return callable callable wrapped by the handler
70 70
      */
71
-    public function getCallable(){
71
+    public function getCallable() {
72 72
         return $this->callable;
73 73
     }
74 74
     
Please login to merge, or discard this patch.
src/Factory/ServiceFactory.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      * @param $config
24 24
      * @return object the initialized service instance
25 25
      */
26
-    public static function createService($config){
26
+    public static function createService($config) {
27 27
         $args = array();
28 28
         //build arguments for constructor
29
-        if($config->constructor_arg){
30
-            foreach($config->constructor_arg as $arg){
29
+        if ($config->constructor_arg) {
30
+            foreach ($config->constructor_arg as $arg) {
31 31
                 $args[] = self::buildArg($arg);
32 32
             }
33 33
         }
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
      * @param string $defaultClass class to create instance for if none is set in config
45 45
      * @return object build and modified srvice instance
46 46
      */
47
-    public static function doBuild($config, $arguments, $defaultClass = false){
47
+    public static function doBuild($config, $arguments, $defaultClass = false) {
48 48
         $cls = $config["class"] ? trim((string)$config["class"]) : (string)$defaultClass;
49
-        if($cls != ''){
49
+        if ($cls != '') {
50 50
             try {
51 51
                 $constructor = (string)$config["constructor"];
52
-        if($constructor != '' && Test::assertMethod($cls, $constructor)){
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
         }
61
-        if(is_object($service)){
61
+        if (is_object($service)) {
62 62
             return $service;
63 63
         }
64 64
         throw new \RuntimeException('Could not create Service "'.$cls.'". Class does not exist.');
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param array $arguments arguments for the constructor
76 76
      * @return object build and modified srvice instance
77 77
      */
78
-    public static function build($className, $arguments){
78
+    public static function build($className, $arguments) {
79 79
         return GenericBuilder::getInstance($className)->build($arguments);
80 80
     }
81 81
 
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
      * @param object $config configuration object to create argument from.
87 87
      * @return mixed build argument
88 88
      */
89
-    protected static function buildArg($config){
90
-        if(trim((string)$config['value']) != ''){
89
+    protected static function buildArg($config) {
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
-            foreach($config->children() as $entry){
97
-                if($entry->getName() == 'value'){
98
-                    if($entry['key']){
96
+            foreach ($config->children() as $entry) {
97
+                if ($entry->getName() == 'value') {
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;
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
      * @param string $defaultClass class to create instance for if none is set in config
127 127
      * @return object build and modified srvice instance
128 128
      */
129
-    public static function buildAndModify($config, $arguments, $defaultClass = false){
130
-        if("" != (string)$config["class"]  || $defaultClass){
129
+    public static function buildAndModify($config, $arguments, $defaultClass = false) {
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
-        if($config["ref_property"]){
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
-            if($config->argument){
140
-                        foreach($config->argument as $arg){
139
+            if ($config->argument) {
140
+                        foreach ($config->argument as $arg) {
141 141
                             $args[] = $this->buildArg($arg);
142 142
                         }
143 143
                 }
144 144
             $service = call_user_func_array(array($service, (string)$config["ref_method"]), $args);
145 145
         }
146
-        if(!is_object($service)){
146
+        if (!is_object($service)) {
147 147
             throw new \RuntimeException('Could not create Service.');
148 148
         }
149 149
         $service = self::modifyService($service, $config);
@@ -166,29 +166,29 @@  discard block
 block discarded – undo
166 166
      * @param object $config configuration to get the modification instructions from.
167 167
      * @return object the modificated service
168 168
      */
169
-    protected function modifyService($service, $config){
169
+    protected function modifyService($service, $config) {
170 170
         $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass();
171 171
         // set instance properties
172
-        if($config->property){
173
-            foreach($config->property as $property){
172
+        if ($config->property) {
173
+            foreach ($config->property as $property) {
174 174
                 $arg = self::buildArg($property);
175
-                if($arg){
175
+                if ($arg) {
176 176
                     $setter = self::getSetter($property);
177
-                    if($setter &&  self::hasPublicProperty($service, 'Method', $setter)){
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
                 }
183 183
             }
184 184
         }
185 185
         // call instance methods
186
-        if($config->action){
187
-            foreach($config->action as $action){
186
+        if ($config->action) {
187
+            foreach ($config->action as $action) {
188 188
                 $method = (string)$action['method'] != '' ? (string)$action['method'] : NULL;
189
-                if($method && self::hasPublicProperty($service, 'Method', $method)){
189
+                if ($method && self::hasPublicProperty($service, 'Method', $method)) {
190 190
                     $args = array();
191
-                    foreach($action->children() as $argument){
191
+                    foreach ($action->children() as $argument) {
192 192
                         $args[] = $this->buildArg($argument);
193 193
                     }
194 194
                     call_user_func_array(array($service, (string)$action['method']), $args);
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
             }
197 197
         }
198 198
         // register instance listeners
199
-        if($service instanceof \PEIP\INF\Event\Connectable){
200
-            if($config->listener){
201
-                foreach($config->listener as $listenerConf){
199
+        if ($service instanceof \PEIP\INF\Event\Connectable) {
200
+            if ($config->listener) {
201
+                foreach ($config->listener as $listenerConf) {
202 202
                     $event = (string)$listenerConf['event'];
203 203
                     $listener = $this->provideService($listenerConf);
204 204
                     $service->connect($event, $listener);
Please login to merge, or discard this patch.
src/Factory/DedicatedFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
      * @param $parameters 
39 39
      * @return 
40 40
      */
41
-    protected function __construct($callable ,array $parameters = array()){
41
+    protected function __construct($callable, array $parameters = array()) {
42 42
         $this->callable = $callable;
43 43
         $this->setParameters($parameters);
44 44
     }
45 45
 
46
-    public static function getfromClass($class, array $parameters = array()){
46
+    public static function getfromClass($class, array $parameters = array()) {
47 47
         return new DedicatedFactory(array($class, '__construct'), $parameters); 
48 48
     } 
49 49
 
50
-    public static function getfromCallable($callable, array $parameters = array()){
50
+    public static function getfromCallable($callable, array $parameters = array()) {
51 51
         return new DedicatedFactory($callable, $parameters); 
52 52
     } 
53 53
     
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param $arguments 
58 58
      * @return 
59 59
      */
60
-    public function build(array $arguments = array()){
60
+    public function build(array $arguments = array()) {
61 61
         $arguments = count($arguments) > 0 ? $arguments : $this->getParameters();
62 62
         return (is_array($this->callable) && $this->callable[1] == '__construct') 
63 63
             ? GenericBuilder::GetInstance($this->callable[0])->build($arguments) 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param $method 
71 71
      * @return 
72 72
      */
73
-    public function setConstructor($method){
73
+    public function setConstructor($method) {
74 74
         $this->constructor = (string)$method;
75 75
         return $this;
76 76
     }   
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/Translator/XMLArrayTranslator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,43 +22,43 @@  discard block
 block discarded – undo
22 22
 
23 23
 class XMLArrayTranslator {
24 24
 
25
-    public static function translate($content){
25
+    public static function translate($content) {
26 26
         $array = array();
27 27
         try {
28 28
             $node = simplexml_load_string($content);
29 29
             // fix for hhvm
30
-            if(!is_a($node, 'SimpleXMLElement')){
30
+            if (!is_a($node, 'SimpleXMLElement')) {
31 31
                 throw new Exception('loading XML failed'); 
32 32
             }
33 33
             
34 34
         }
35
-        catch(\Exception $e){
35
+        catch (\Exception $e) {
36 36
             return false;
37 37
         }     
38 38
         
39 39
         return self::doTranslate($node);
40 40
     }
41 41
 
42
-    protected static function doTranslate(\SimpleXMLElement $node){
42
+    protected static function doTranslate(\SimpleXMLElement $node) {
43 43
         
44 44
         $array = array();
45 45
         $array['type'] = $node['type']
46 46
             ? (string)$node['type']
47 47
             : (string)$node->getName();
48 48
         $value = (string)$node;
49
-        if($value != ''){
49
+        if ($value != '') {
50 50
             $array['value'] = $value;
51 51
         }
52 52
 
53
-        foreach($node->attributes() as $name=>$value){
53
+        foreach ($node->attributes() as $name=>$value) {
54 54
             $array[$name] = (string)$value;
55 55
         }
56
-        foreach($node->children() as $nr=>$child){
56
+        foreach ($node->children() as $nr=>$child) {
57 57
             $name = $child->getName();
58 58
             $res = self::doTranslate($child);
59 59
 
60
-            if(isset($array[$name])){
61
-                if(is_string($array[$name])){
60
+            if (isset($array[$name])) {
61
+                if (is_string($array[$name])) {
62 62
                     $array[$name] = array(
63 63
                         array(
64 64
                             'type'=>$name,
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                         )
67 67
                     );
68 68
                 }
69
-            }else{
69
+            }else {
70 70
                 $array[$name] = array();
71 71
             }
72 72
             $array[$name][] = $res;
Please login to merge, or discard this patch.