Completed
Push — v1.ns ( a6bb16...dc5273 )
by Timo
03:36
created
src/Dispatcher/EventClassDispatcher.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Event\EventBuilder;
14
+use PEIP\Event\EventBuilder;
15 15
 use PEIP\Util\ReflectionPool;
16 16
 
17 17
 class EventClassDispatcher
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
      * @param \PEIP\INF\Event\Event $object an event object
26 26
      * @return boolean
27 27
      */
28
-    public function notify($name, $object){ 
29
-        if($object instanceof \PEIP\INF\Event\Event){
30
-            if(is_object($object->getContent())){
28
+    public function notify($name, $object) { 
29
+        if ($object instanceof \PEIP\INF\Event\Event) {
30
+            if (is_object($object->getContent())) {
31 31
                 return self::doNotify(
32 32
                     $this->getListeners(
33 33
                         $name,
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
                      ),
36 36
                      $object->getContent()
37 37
                  );
38
-            }else{
38
+            }else {
39 39
                 throw new \InvalidArgumentException('instance of \PEIP\INF\Event\Event must contain subject');
40 40
             }
41
-        }else{
41
+        }else {
42 42
             throw new \InvalidArgumentException('object must be instance of \PEIP\INF\Event\Event');
43 43
         }
44 44
     }       //put your code here
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
      * @return
56 56
      * @see EventBuilder
57 57
      */
58
-    public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false){
59
-        if(!$this->hasListeners($name, ($object))){
58
+    public function buildAndNotify($name, $object, array $headers = array(), $eventClass = false, $type = false) {
59
+        if (!$this->hasListeners($name, ($object))) {
60 60
             return false;
61 61
         }
62 62
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @param object $object object to check for listeners
80 80
      * @return boolean
81 81
      */
82
-    public function hasListeners($name, $object){
82
+    public function hasListeners($name, $object) {
83 83
         return parent::hasListeners(
84 84
             $name,
85 85
             ReflectionPool::getInstance($object)
Please login to merge, or discard this patch.
src/Factory/ServiceFactory.php 2 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.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      * @param $config configuration of the service
24 24
      * @return object the initialized service instance
25 25
      */
26
-    public static function createService(array $config){
26
+    public static function createService(array $config) {
27 27
         $args = array();
28 28
         //build arguments for constructor
29
-        if(isset($config['constructor_arg'])){
30
-            foreach($config['constructor_arg'] as $arg){
29
+        if (isset($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 = isset($config["class"]) ? trim((string)$config["class"]) : (string)$defaultClass;
49
-        if($cls != ''){
49
+        if ($cls != '') {
50 50
             try {
51
-                $constructor = isset($config["constructor"])?(string)$config["constructor"]:"";
52
-                if($constructor != '' && Test::assertMethod($cls, $constructor)){
51
+                $constructor = isset($config["constructor"]) ? (string)$config["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 function buildArg($config){
90
-        if(trim((string)$config['value']) != ''){
89
+    protected 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 = $this->buildArg($config->list);
111
-        }elseif($config->service){
111
+        }elseif ($config->service) {
112 112
             $arg = $this->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(array $config, $arguments, $defaultClass = ""){
130
-        if((isset($config["class"]) && "" != (string)$config["class"])  || $defaultClass !== ""){
129
+    public static function buildAndModify(array $config, $arguments, $defaultClass = "") {
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
-        if(isset($config["ref_property"])){
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
-            if(isset($config['argument'])){
140
-                        foreach($config['argument'] as $arg){
139
+            if (isset($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);
@@ -165,29 +165,29 @@  discard block
 block discarded – undo
165 165
      * @param object $config configuration to get the modification instructions from.
166 166
      * @return object the modificated service
167 167
      */
168
-    protected function modifyService($service, $config){        
168
+    protected function modifyService($service, $config) {        
169 169
         $config = is_array($config) ? new \ArrayObject($config) : $config;
170 170
         // set instance properties
171
-        if(isset($config->property)){
172
-            foreach($config->property as $property){
171
+        if (isset($config->property)) {
172
+            foreach ($config->property as $property) {
173 173
                 $arg = $this->buildArg($property);
174
-                if($arg){
174
+                if ($arg) {
175 175
                     $setter = self::getSetter($property);
176
-                    if($setter &&  self::hasPublicProperty($service, 'Method', $setter)){
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
                 }
182 182
             }
183 183
         }
184 184
         // call instance methods
185
-        if(isset($config->action)){
186
-            foreach($config->action as $action){
185
+        if (isset($config->action)) {
186
+            foreach ($config->action as $action) {
187 187
                 $method = (string)$action['method'] != '' ? (string)$action['method'] : NULL;
188
-                if($method && self::hasPublicProperty($service, 'Method', $method)){
188
+                if ($method && self::hasPublicProperty($service, 'Method', $method)) {
189 189
                     $args = array();
190
-                    foreach($action->children() as $argument){
190
+                    foreach ($action->children() as $argument) {
191 191
                         $args[] = $this->buildArg($argument);
192 192
                     }
193 193
                     call_user_func_array(array($service, (string)$action['method']), $args);
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
             }
196 196
         }
197 197
         // register instance listeners
198
-        if($service instanceof \PEIP\INF\Event\Connectable){
199
-            if(isset($config->listener)){
200
-                foreach($config->listener as $listenerConf){
198
+        if ($service instanceof \PEIP\INF\Event\Connectable) {
199
+            if (isset($config->listener)) {
200
+                foreach ($config->listener as $listenerConf) {
201 201
                     $event = (string)$listenerConf['event'];
202 202
                     $listener = $this->provideService($listenerConf);
203 203
                     $service->connect($event, $listener);
Please login to merge, or discard this patch.
src/Message/GenericMessage.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
  * @implements \PEIP\INF\Base\Container, \PEIP\INF\Message\Message, \PEIP\INF\Base\Buildable
21 21
  */
22 22
 
23
-use PEIP\Util\Test;
23
+use PEIP\Util\Test;
24 24
 use PEIP\Base\GenericBuilder;
25 25
 
26 26
 class GenericMessage 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param mixed $content The content/payload of the message 
42 42
      * @param array|ArrayAccess $headers headers as key/value pairs
43 43
      */
44
-    public function __construct($content, $headers = array()){
44
+    public function __construct($content, $headers = array()) {
45 45
         $this->doSetContent($content);
46 46
         $this->doSetHeaders($headers);          
47 47
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @access public
54 54
      * @return
55 55
      */
56
-    public function getContent(){
56
+    public function getContent() {
57 57
         return $this->content;
58 58
     }
59 59
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
      * @access protected
64 64
      * @param mixed $content The content/payload of the message 
65 65
      */
66
-    protected function doSetContent($content){
66
+    protected function doSetContent($content) {
67 67
         $this->content = Test::castType($content, self::CONTENT_CAST_TYPE);
68 68
     }
69 69
 
70
-    protected function doSetHeaders($headers){
70
+    protected function doSetHeaders($headers) {
71 71
         $headers = Test::ensureArrayAccess($headers);
72
-        if(is_array($headers)){
72
+        if (is_array($headers)) {
73 73
             $headers = new \ArrayObject($headers);
74 74
         }
75 75
         $this->headers = $headers;
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
      * @access public
82 82
      * @return ArrayAccess ArrayAccess object of headers
83 83
      */
84
-    public function getHeaders(){
85
-        return (array) $this->headers;
84
+    public function getHeaders() {
85
+        return (array)$this->headers;
86 86
     }
87 87
   
88 88
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param string $name the name of the header  
93 93
      * @return mixed the value of the header
94 94
      */
95
-    public function getHeader($name){
95
+    public function getHeader($name) {
96 96
         $name = (string)$name;
97 97
         return isset($this->headers[$name]) ? $this->headers[$name] : NULL;
98 98
     }
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      * @param string $name the name of the header
106 106
      * @return boolean wether the header has been successfully  set
107 107
      */
108
-    public function addHeader($name, $value){
109
-        if(!$this->hasHeader($name)){
108
+    public function addHeader($name, $value) {
109
+        if (!$this->hasHeader($name)) {
110 110
             $this->headers[$name] = $value;
111 111
             return true;
112 112
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @param string $name the name of the header
121 121
      * @return boolean wether the header is set
122 122
      */
123
-    public function hasHeader($name){
123
+    public function hasHeader($name) {
124 124
         return isset($this->headers[$name]);
125 125
     }
126 126
 
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
      * @access public
131 131
      * @return string  content/payload of the message
132 132
      */
133
-    public function __toString(){
133
+    public function __toString() {
134 134
         $res = false;
135 135
         try {
136 136
             $res = (string)$this->getContent();
137 137
         }
138
-        catch(\Exception $e){           
138
+        catch (\Exception $e) {           
139 139
             try {
140 140
                 $res = get_class($this->getContent());
141 141
             }
142
-            catch(\Exception $e){
142
+            catch (\Exception $e) {
143 143
 
144 144
             }
145 145
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @param array $arguments argumends for the constructor
160 160
      * @return GenericMessage new class instance
161 161
      */    
162
-    public static function build(array $arguments = array()){
162
+    public static function build(array $arguments = array()) {
163 163
         return GenericBuilder::getInstance(__CLASS__)->build($arguments);
164 164
     }     
165 165
 } 
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
src/Service/ServiceProvider.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @author timo
13 13
  */
14
-use PEIP\Context\XMLContext;
14
+use PEIP\Context\XMLContext;
15 15
 use PEIP\Plugins\BasePlugin;
16 16
 
17 17
 class ServiceProvider extends \PEIP\Service\ServiceContainer  {
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,17 +83,17 @@  discard block
 block discarded – undo
83 83
      * @see XMLContext::includeContext
84 84
      * @access protected
85 85
      */
86
-    protected function initNodeBuilders(){ return;
86
+    protected function initNodeBuilders() { return;
87 87
         $builders = array(
88 88
             'service' => 'initService'
89 89
         );
90 90
         $plugin = new BasePlugin();
91
-        foreach($builders as $nodeName => $method){
91
+        foreach ($builders as $nodeName => $method) {
92 92
            $this->registerNodeBuilder($nodeName, array($this, $method));
93 93
         }
94 94
     }
95 95
 
96
-    public function addConfig($config){ 
96
+    public function addConfig($config) { 
97 97
         $this->doFireEvent(
98 98
             self::EVENT_BEFORE_ADD_CONFIG,
99 99
             array(
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
         );
113 113
     }
114 114
 
115
-    public function provideService($key){
115
+    public function provideService($key) {
116 116
         $this->doFireEvent(self::EVENT_BEFORE_PROVIDE_SERVICE, array(
117 117
             self::HEADER_KEY=>$key)
118 118
         );
119 119
 
120
-        if($this->hasService($key)){
121
-            $service =  $this->getService($key);
122
-        }else{
123
-            $service =  $this->createService($key);
120
+        if ($this->hasService($key)) {
121
+            $service = $this->getService($key);
122
+        }else {
123
+            $service = $this->createService($key);
124 124
         }
125 125
 
126 126
         $this->doFireEvent(self::EVENT_AFTER_PROVIDE_SERVICE, array(
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
         return $service;
132 132
     }
133 133
 
134
-    protected function createService($key){
134
+    protected function createService($key) {
135 135
         $this->doFireEvent(self::EVENT_BEFORE_CREATE_SERVICE, array(
136 136
             self::HEADER_KEY=>$key)
137 137
         );
138 138
         $errorMessage = '';
139 139
         $config = $this->getServiceConfig($key);
140 140
 
141
-        if($config){
141
+        if ($config) {
142 142
             $node = $this->buildNode($config);
143
-            if($node){
143
+            if ($node) {
144 144
                 $this->setService(
145 145
                     $key,
146 146
                     $node
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
                 ));
152 152
 
153 153
                 return $node;                
154
-            }else{
154
+            }else {
155 155
                 $errorMessage = 'COULD NOT BUILD NODE FOR KEY: '.$key;
156 156
             }
157 157
 
158
-        }else{
158
+        }else {
159 159
             $errorMessage = 'NO CONFIG FOR KEY: '.$key;
160 160
         }
161 161
         $this->doFireEvent(self::EVENT_CREATE_SERVICE_ERROR, array(
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
         return NULL;
166 166
     }
167 167
 
168
-    public function getServiceConfig($key){
169
-        if(!isset($this->ids[$key])){
168
+    public function getServiceConfig($key) {
169
+        if (!isset($this->ids[$key])) {
170 170
             return false;
171 171
         }
172 172
         return $this->config[$this->ids[$key]];
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      * @param object $config configuration-node
182 182
      * @return void
183 183
      */
184
-    protected function buildNode($config){
184
+    protected function buildNode($config) {
185 185
         $nodeName = (string)$config['type'];
186 186
 
187 187
         $this->doFireEvent(self::EVENT_BEFORE_BUILD_NODE, array(
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
             self::HEADER_NODE_NAME=> $nodeName
190 190
         ));
191 191
         // call the builder method registered for the node.
192
-        if(array_key_exists($nodeName, $this->nodeBuilders)){
192
+        if (array_key_exists($nodeName, $this->nodeBuilders)) {
193 193
 
194 194
             $nodeInstance = call_user_func($this->nodeBuilders[$nodeName], $config);
195
-            if(is_object($nodeInstance)){
195
+            if (is_object($nodeInstance)) {
196 196
                 $this->doFireEvent(self::EVENT_BUILD_NODE_SUCCESS, array(
197 197
                     self::HEADER_NODE_CONFIG=>$config,
198 198
                     self::HEADER_NODE_NAME=> $nodeName,
199 199
                     self::HEADER_NODE => $nodeInstance
200 200
                 ));
201 201
                 return $nodeInstance;
202
-            }else{
202
+            }else {
203 203
                 $errorMessage = 'BUILDER RETURNED NO OBJECT FOR NODE-TYPE: '.$nodeName;
204 204
             }
205
-        }else{
205
+        }else {
206 206
             $errorMessage = 'NO BUILDER FOUND FOR NODE-TYPE: '.$nodeName;
207 207
         }
208 208
 
@@ -213,27 +213,27 @@  discard block
 block discarded – undo
213 213
         ));
214 214
     }
215 215
 
216
-    protected function getIdFromConfig($config){
216
+    protected function getIdFromConfig($config) {
217 217
         $id = '';
218
-        if(isset($config[$this->idAttribute])){
218
+        if (isset($config[$this->idAttribute])) {
219 219
             $id = trim((string)($config[$this->idAttribute]));
220 220
         }
221 221
         return $id;
222 222
     }
223 223
 
224
-    protected function getCountConfig(){
224
+    protected function getCountConfig() {
225 225
         return count($this->config);
226 226
     }
227 227
 
228
-    protected function doAddConfig($config){
228
+    protected function doAddConfig($config) {
229 229
         $countConfig = $this->getCountConfig();
230 230
         $this->config[$countConfig] = $config;
231 231
         return $countConfig;
232 232
     }
233 233
 
234
-    protected function doRegisterConfig($config){
235
-        $id  = $this->getIdFromConfig($config);
236
-        if($id != ''){
234
+    protected function doRegisterConfig($config) {
235
+        $id = $this->getIdFromConfig($config);
236
+        if ($id != '') {
237 237
             $this->ids[$id] = $this->getCountConfig() - 1;
238 238
         }
239 239
         return $id;
Please login to merge, or discard this patch.
examples/Cafe/lib/model/Barista.php 1 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.
examples/Cafe/lib/model/Order.php 1 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 1 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 1 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.
examples/Cafe/lib/model/Waiter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@
 block discarded – undo
5 5
 
6 6
 	protected $orders;
7 7
 	
8
-	public function prepareDelivery(array $drinks){
8
+	public function prepareDelivery(array $drinks) {
9 9
 		echo PEIP_LINE_SEPARATOR.'Waiter: prepareDelivery: #'.$drinks[0]->getOrderNumber();
10 10
 		return new Delivery($drinks);
11 11
 	}
12 12
 
13 13
 	
14
-	public function receiveOrder(Order $order){
14
+	public function receiveOrder(Order $order) {
15 15
 		echo PEIP_LINE_SEPARATOR.'Waiter: receiveOrder';
16 16
 		$this->orders[$order->getOrderNumber()] = $order;	
17 17
 	}
18 18
 	
19
-	public function getOrder($nr){
19
+	public function getOrder($nr) {
20 20
 		return $this->orders[$nr];
21 21
 	}
22 22
 	
Please login to merge, or discard this patch.