Completed
Push — v1.ns ( 6f2676...0f96a8 )
by Timo
03:42
created
src/Base/GenericBuilder.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      * 
40 40
      * @access public
41 41
      * @param string $className class-name to create objects for
42
-     * @param ReflectionClass $reflectionClass reflection-class for class. default: NULL 
42
+     * @param \ReflectionClass $reflectionClass reflection-class for class. default: NULL 
43 43
      * @param boolean $storeRef wether to store a reference for new instance. default: true 
44 44
      * @return 
45 45
      */
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
      * @param boolean $storeRef wether to store a reference for new instance. default: true 
44 44
      * @return 
45 45
      */
46
-    public function __construct($className, \ReflectionClass $reflectionClass = NULL, $storeRef = true){
47
-        if($reflectionClass ){
46
+    public function __construct($className, \ReflectionClass $reflectionClass = NULL, $storeRef = true) {
47
+        if ($reflectionClass) {
48 48
             
49
-            if($reflectionClass->getName() != $className){
49
+            if ($reflectionClass->getName() != $className) {
50 50
                 throw new \Exception(
51 51
                     'Constructing GenericBuilder with wrong ReflectionClass'
52 52
                 );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $this->reflectionClass = $reflectionClass;
57 57
         }
58 58
         $this->className = $className;
59
-        if($storeRef){
59
+        if ($storeRef) {
60 60
             self::$instances[$this->className] = $this;
61 61
         }            
62 62
     }
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      * @param string $className class-name to return builder instance for 
69 69
      * @return GenericBuilder builder instance for class
70 70
      */
71
-    public static function getInstance($className){
72
-        if(!array_key_exists((string)$className, self::$instances)) {
71
+    public static function getInstance($className) {
72
+        if (!array_key_exists((string)$className, self::$instances)) {
73 73
             new GenericBuilder($className);
74 74
         }
75 75
         return self::$instances[$className];
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
      * @param array $arguments array of constructore arguments
83 83
      * @return object the created object instance
84 84
      */
85
-    public function build(array $arguments = array()){      
86
-        if(Test::assertClassHasConstructor($this->className)){
87
-            if(!Test::assertRequiredConstructorParameters($this->className, $arguments)){
85
+    public function build(array $arguments = array()) {      
86
+        if (Test::assertClassHasConstructor($this->className)) {
87
+            if (!Test::assertRequiredConstructorParameters($this->className, $arguments)) {
88 88
                 throw new \Exception('Missing Argument '.(count($arguments) + 1).' for '.$this->className.'::__construct');
89 89
             }
90 90
             return $this->getReflectionClass()->newInstanceArgs($arguments);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @access public
99 99
      * @return ReflectionClass
100 100
      */
101
-    public function getReflectionClass(){
101
+    public function getReflectionClass() {
102 102
         return ReflectionPool::getInstance($this->className);
103 103
     }
104 104
     
Please login to merge, or discard this patch.
src/Event/EventBuilder.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,6 @@
 block discarded – undo
83 83
      * @param ObjectEventDispatcher $dispatcher the dispatcher to dispatch the event 
84 84
      * @param mixed $subject the subject for the event
85 85
      * @param string $name the name of the event
86
-     * @param array $parameters the headers for the event
87 86
      * @return 
88 87
      */
89 88
     public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()){
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param string $eventClass the event-class the builder shall create instances for 
38 38
      * @param array $defaultHeaders default headers for the created events 
39 39
      */
40
-    public function __construct($eventClass = '\PEIP\Event\Event', array $defaultHeaders = array()){
40
+    public function __construct($eventClass = '\PEIP\Event\Event', array $defaultHeaders = array()) {
41 41
         $this->eventClass = $eventClass;
42 42
         $this->defaultParameters = $defaultHeaders;
43 43
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param string $eventClass the event-class the builder shall create instances for 
50 50
      * @return EventBuilder the instance of EventBuilder for the given event-class 
51 51
      */    
52
-    public static function getInstance($eventClass = '\PEIP\Event\Event'){ 
52
+    public static function getInstance($eventClass = '\PEIP\Event\Event') { 
53 53
 
54 54
         return isset(self::$instances[$eventClass]) 
55 55
             ? self::$instances[$eventClass] 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @param array $headers the headers for the event 
68 68
      * @return object event instance
69 69
      */
70
-    public function build($subject, $name, array $headers = array()){
70
+    public function build($subject, $name, array $headers = array()) {
71 71
 
72 72
         return new $this->eventClass(
73 73
             $subject,
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param array $parameters the headers for the event
87 87
      * @return 
88 88
      */
89
-    public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()){
89
+    public function buildAndDispatch(ObjectEventDispatcher $dispatcher, $subject, $name, array $headers = array()) {
90 90
   
91 91
         return $dispatcher->notify(
92 92
             $name,
Please login to merge, or discard this patch.
src/Factory/DedicatedFactory.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
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
     } 
Please login to merge, or discard this 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/Factory/ServiceFactory.php 3 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Util\Test;
15
-use PEIP\Base\GenericBuilder;
14
+use PEIP\Util\Test;
15
+use PEIP\Base\GenericBuilder;
16 16
 use PEIP\Context\XMLContext;
17 17
 
18 18
 class ServiceFactory {
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
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) {
@@ -89,26 +89,26 @@  discard block
 block discarded – undo
89 89
     protected static function buildArg($config) {
90 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 96
             foreach ($config->children() as $entry) {
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
-                }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;
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
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"])) {
136 136
             $service = $service->{(string)$config["ref_property"]};
137
-        }elseif (isset($config["ref_method"])) {
137
+        } elseif (isset($config["ref_method"])) {
138 138
                 $args = array();
139 139
             if (isset($config['argument'])) {
140 140
                         foreach ($config['argument'] as $arg) {
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                     $setter = self::getSetter($property);
176 176
                     if ($setter && self::hasPublicProperty($service, 'Method', $setter)) {
177 177
                         $service->{$setter}($arg);
178
-                    }elseif (in_array($property, self::hasPublicProperty($service, 'Property', $setter))) {
178
+                    } elseif (in_array($property, self::hasPublicProperty($service, 'Property', $setter))) {
179 179
                         $service->$setter = $arg;
180 180
                     }
181 181
                 }
Please login to merge, or discard this patch.
src/Service/ServiceProvider.php 5 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -112,6 +112,9 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
  * @author timo
13 13
  */
14 14
 use PEIP\Context\XMLContext;
15
-use PEIP\Plugins\BasePlugin;
16 15
 
17 16
 class ServiceProvider extends \PEIP\Service\ServiceContainer  {
18 17
 
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
         /**
66
-     * Registers a callable as builder for given node-name
67
-     *
68
-     * @implements \PEIP\INF\Context\Context
69
-     * @access public
70
-     * @param string $nodeName the name of the node
71
-     * @param callable $callable a callable which creates instances for node-name
72
-     */
66
+         * Registers a callable as builder for given node-name
67
+         *
68
+         * @implements \PEIP\INF\Context\Context
69
+         * @access public
70
+         * @param string $nodeName the name of the node
71
+         * @param callable $callable a callable which creates instances for node-name
72
+         */
73 73
     public function registerNodeBuilder($nodeName, $callable){
74 74
         $this->nodeBuilders[$nodeName] = $callable;
75 75
     }
76
-  /**
76
+    /**
77 77
      * Registers the build-methods for the main-components with this context.
78 78
      * Note: This method and subsequent registered methods of this class are
79 79
      * candidates for refactoring. Because this class has grown much to large
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             'service' => 'initService'
89 89
         );
90 90
         foreach($builders as $nodeName => $method){
91
-           $this->registerNodeBuilder($nodeName, array($this, $method));
91
+            $this->registerNodeBuilder($nodeName, array($this, $method));
92 92
         }
93 93
     }
94 94
 
Please login to merge, or discard this 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.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
         if($this->hasService($key)){
120 120
             $service =  $this->getService($key);
121
-        }else{
121
+        } else{
122 122
             $service =  $this->createService($key);
123 123
         }
124 124
 
@@ -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(
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Barista.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
     }    
32 32
 	
33 33
     protected function prepareDrink($orderNumber, $type, $iced){
34
-    	$drink = new Drink($orderNumber, $type, $iced);	
35
-    	return $drink;
34
+        $drink = new Drink($orderNumber, $type, $iced);	
35
+        return $drink;
36 36
     }
37 37
 
38 38
     protected function printAction($cold, $orderNr){
39
-    	if($cold){
40
-    		$type = 'cold';
41
-    		$count = $this->coldDrinkCounter;
42
-    	}else{
43
-    		$type = 'hot';
44
-    		$count = $this->hotDrinkCounter;    		
45
-    	}
46
-    	$total = $this->coldDrinkCounter + $this->hotDrinkCounter;
39
+        if($cold){
40
+            $type = 'cold';
41
+            $count = $this->coldDrinkCounter;
42
+        }else{
43
+            $type = 'hot';
44
+            $count = $this->hotDrinkCounter;    		
45
+        }
46
+        $total = $this->coldDrinkCounter + $this->hotDrinkCounter;
47 47
         echo PEIP_LINE_SEPARATOR."Barista: prepared $type drink (total #$total- $type #$count) for order #$orderNr";
48 48
         flush();    
49 49
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@
 block discarded – undo
30 30
         return $this->prepareDrink($orderItem['order'], $orderItem['type'], true);
31 31
     }    
32 32
 	
33
-    protected function prepareDrink($orderNumber, $type, $iced){
33
+    protected function prepareDrink($orderNumber, $type, $iced) {
34 34
     	$drink = new Drink($orderNumber, $type, $iced);	
35 35
     	return $drink;
36 36
     }
37 37
 
38
-    protected function printAction($cold, $orderNr){
39
-    	if($cold){
38
+    protected function printAction($cold, $orderNr) {
39
+    	if ($cold) {
40 40
     		$type = 'cold';
41 41
     		$count = $this->coldDrinkCounter;
42
-    	}else{
42
+    	}else {
43 43
     		$type = 'hot';
44 44
     		$count = $this->hotDrinkCounter;    		
45 45
     	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     	if($cold){
40 40
     		$type = 'cold';
41 41
     		$count = $this->coldDrinkCounter;
42
-    	}else{
42
+    	} else{
43 43
     		$type = 'hot';
44 44
     		$count = $this->hotDrinkCounter;    		
45 45
     	}
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Order.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -2,40 +2,40 @@
 block discarded – undo
2 2
 
3 3
 class Order {
4 4
 
5
-	protected 
6
-		$items = array(),
7
-		$orderNumber;
8
-	protected static $orderCount = 0;
5
+    protected 
6
+        $items = array(),
7
+        $orderNumber;
8
+    protected static $orderCount = 0;
9 9
 
10
-	public function __construct(){
11
-		self::$orderCount++;
12
-		$this->orderNumber = self::$orderCount;
13
-	}	
10
+    public function __construct(){
11
+        self::$orderCount++;
12
+        $this->orderNumber = self::$orderCount;
13
+    }	
14 14
 
15
-	public function getOrderNumber(){
16
-		return $this->orderNumber;
17
-	}
15
+    public function getOrderNumber(){
16
+        return $this->orderNumber;
17
+    }
18 18
 	
19
-	public function addItem($type, $number, $iced = false){
20
-		$this->items[] = 
21
-			array(
22
-				'type' => $type,
23
-				'number' => $number,
24
-				'iced' => $iced
25
-			);
26
-	}
19
+    public function addItem($type, $number, $iced = false){
20
+        $this->items[] = 
21
+            array(
22
+                'type' => $type,
23
+                'number' => $number,
24
+                'iced' => $iced
25
+            );
26
+    }
27 27
 
28
-	public function getItems(){
29
-		return $this->items;
30
-	}
28
+    public function getItems(){
29
+        return $this->items;
30
+    }
31 31
 
32
-	public function getTotalCount(){
33
-		$x = 0;
34
-		foreach($this->items as $item){
35
-			$x += (int)$item['number'];
36
-		}
37
-		return $x;
38
-	}
32
+    public function getTotalCount(){
33
+        $x = 0;
34
+        foreach($this->items as $item){
35
+            $x += (int)$item['number'];
36
+        }
37
+        return $x;
38
+    }
39 39
 	
40 40
 	
41 41
 	
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 		$orderNumber;
8 8
 	protected static $orderCount = 0;
9 9
 
10
-	public function __construct(){
10
+	public function __construct() {
11 11
 		self::$orderCount++;
12 12
 		$this->orderNumber = self::$orderCount;
13 13
 	}	
14 14
 
15
-	public function getOrderNumber(){
15
+	public function getOrderNumber() {
16 16
 		return $this->orderNumber;
17 17
 	}
18 18
 	
19
-	public function addItem($type, $number, $iced = false){
19
+	public function addItem($type, $number, $iced = false) {
20 20
 		$this->items[] = 
21 21
 			array(
22 22
 				'type' => $type,
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 			);
26 26
 	}
27 27
 
28
-	public function getItems(){
28
+	public function getItems() {
29 29
 		return $this->items;
30 30
 	}
31 31
 
32
-	public function getTotalCount(){
32
+	public function getTotalCount() {
33 33
 		$x = 0;
34
-		foreach($this->items as $item){
34
+		foreach ($this->items as $item) {
35 35
 			$x += (int)$item['number'];
36 36
 		}
37 37
 		return $x;
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Delivery.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
 
3 3
 class Delivery {
4 4
 
5
-	protected 
6
-		$deliveredDrinks,
7
-		$orderNumber;
5
+    protected 
6
+        $deliveredDrinks,
7
+        $orderNumber;
8 8
 	
9
-	public function __construct(array $deliveredDrinks){
10
-		$this->deliveredDrinks = $deliveredDrinks;
11
-		$this->orderNumber = $deliveredDrinks[0]->getOrderNumber();
12
-	}
9
+    public function __construct(array $deliveredDrinks){
10
+        $this->deliveredDrinks = $deliveredDrinks;
11
+        $this->orderNumber = $deliveredDrinks[0]->getOrderNumber();
12
+    }
13 13
 
14 14
 
15 15
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 		$deliveredDrinks,
7 7
 		$orderNumber;
8 8
 	
9
-	public function __construct(array $deliveredDrinks){
9
+	public function __construct(array $deliveredDrinks) {
10 10
 		$this->deliveredDrinks = $deliveredDrinks;
11 11
 		$this->orderNumber = $deliveredDrinks[0]->getOrderNumber();
12 12
 	}
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Drink.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,30 +3,30 @@
 block discarded – undo
3 3
 
4 4
 class Drink {
5 5
 
6
-	protected 
7
-		$orderNumber,
8
-		$type,
9
-		$iced;
6
+    protected 
7
+        $orderNumber,
8
+        $type,
9
+        $iced;
10 10
 	
11
-	public function __construct($orderNumber, $type, $iced){
12
-		$this->orderNumber = $orderNumber;
13
-		$this->type = $type;
14
-		$this->iced = $iced;
15
-	}
11
+    public function __construct($orderNumber, $type, $iced){
12
+        $this->orderNumber = $orderNumber;
13
+        $this->type = $type;
14
+        $this->iced = $iced;
15
+    }
16 16
 
17
-	public function getType(){
18
-		return $this->type; 
19
-	}
17
+    public function getType(){
18
+        return $this->type; 
19
+    }
20 20
 
21
-	public function getIced(){
22
-		return $this->iced; 
23
-	}	
21
+    public function getIced(){
22
+        return $this->iced; 
23
+    }	
24 24
 
25
-	public function getOrderNumber(){
26
-		return $this->orderNumber;
27
-	}
25
+    public function getOrderNumber(){
26
+        return $this->orderNumber;
27
+    }
28 28
 	
29
-	public function __sleep()
29
+    public function __sleep()
30 30
     {
31 31
         return array('orderNumber', 'type', 'iced');
32 32
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@
 block discarded – undo
8 8
 		$type,
9 9
 		$iced;
10 10
 	
11
-	public function __construct($orderNumber, $type, $iced){
11
+	public function __construct($orderNumber, $type, $iced) {
12 12
 		$this->orderNumber = $orderNumber;
13 13
 		$this->type = $type;
14 14
 		$this->iced = $iced;
15 15
 	}
16 16
 
17
-	public function getType(){
17
+	public function getType() {
18 18
 		return $this->type; 
19 19
 	}
20 20
 
21
-	public function getIced(){
21
+	public function getIced() {
22 22
 		return $this->iced; 
23 23
 	}	
24 24
 
25
-	public function getOrderNumber(){
25
+	public function getOrderNumber() {
26 26
 		return $this->orderNumber;
27 27
 	}
28 28
 	
Please login to merge, or discard this patch.