@@ -6,9 +6,9 @@ |
||
6 | 6 | class DrinkRouter |
7 | 7 | extends Router { |
8 | 8 | |
9 | - protected function selectChannels(Message $message){ |
|
9 | + protected function selectChannels(Message $message) { |
|
10 | 10 | $order = $message->getContent(); |
11 | - $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
11 | + $channelName = $order['iced'] ? 'coldDrinks' : 'hotDrinks'; |
|
12 | 12 | echo PEIP_LINE_SEPARATOR."DrinkRouter: routed to channel: $channelName"; |
13 | 13 | return $channelName; |
14 | 14 | } |
@@ -5,15 +5,15 @@ |
||
5 | 5 | |
6 | 6 | class OrderSplitter extends MessageSplitter { |
7 | 7 | |
8 | - public function split(Message $message){ |
|
8 | + public function split(Message $message) { |
|
9 | 9 | $order = $message->getContent(); |
10 | 10 | $orderItems = $order->getItems(); |
11 | 11 | $items = array(); |
12 | - foreach($orderItems as $item){ |
|
12 | + foreach ($orderItems as $item) { |
|
13 | 13 | $nr = $item['number']; |
14 | 14 | unset($item['number']); |
15 | 15 | $item['order'] = $order->getOrderNumber(); |
16 | - for($x = 0; $x < $nr; $x++){ |
|
16 | + for ($x = 0; $x < $nr; $x++) { |
|
17 | 17 | $items[] = $item; |
18 | 18 | } |
19 | 19 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | class Cafe |
4 | 4 | extends \PEIP\Gateway\SimpleMessagingGateway { |
5 | 5 | |
6 | - public function placeOrder(Order $order){ |
|
6 | + public function placeOrder(Order $order) { |
|
7 | 7 | return $this->sendAndReceive($order); |
8 | 8 | } |
9 | 9 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | // simple service class |
10 | 10 | class HelloService { |
11 | 11 | |
12 | - public function greet($name){ |
|
12 | + public function greet($name) { |
|
13 | 13 | return 'Hello '.$name; |
14 | 14 | } |
15 | 15 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param mixed $offset the offset |
33 | 33 | * @return |
34 | 34 | */ |
35 | - public function offsetExists($offset){ |
|
35 | + public function offsetExists($offset) { |
|
36 | 36 | return array_key_exists($name, $this->values); |
37 | 37 | } |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param mixed $offset the offset |
44 | 44 | * @return |
45 | 45 | */ |
46 | - public function offsetGet($offset){ |
|
46 | + public function offsetGet($offset) { |
|
47 | 47 | return array_key_exists($name, $this->values) ? $this->values[$offset] : NULL; |
48 | 48 | } |
49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param mixed $offset the offset |
55 | 55 | * @return |
56 | 56 | */ |
57 | - public function offsetUnset($offset){ |
|
57 | + public function offsetUnset($offset) { |
|
58 | 58 | unset($this->values[$offset]); |
59 | 59 | } |
60 | 60 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param mixed $value value for the offset |
67 | 67 | * @return |
68 | 68 | */ |
69 | - public function offsetSet($offset, $value){ |
|
69 | + public function offsetSet($offset, $value) { |
|
70 | 70 | $this->values[$offset] = $value; |
71 | 71 | } |
72 | 72 |
@@ -33,10 +33,10 @@ |
||
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; |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @param $observedObject |
37 | 37 | * @return |
38 | 38 | */ |
39 | - public function __construct($observedObject){ |
|
39 | + public function __construct($observedObject) { |
|
40 | 40 | $this->setObserved($observedObject); |
41 | 41 | } |
42 | 42 | |
43 | - protected function setObserved($observedObject){ |
|
44 | - if(!is_object($observedObject)){ |
|
43 | + protected function setObserved($observedObject) { |
|
44 | + if (!is_object($observedObject)) { |
|
45 | 45 | throw new \InvalidArgumentException("$observedObject must be an object. ".gettype($var)." given."); |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param $observer |
54 | 54 | * @return |
55 | 55 | */ |
56 | - public function addObserver(\PEIP\INF\Event\Observer $observer){ |
|
56 | + public function addObserver(\PEIP\INF\Event\Observer $observer) { |
|
57 | 57 | $this->observers[] = $observer; |
58 | 58 | } |
59 | 59 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param $observer |
64 | 64 | * @return |
65 | 65 | */ |
66 | - public function deleteObserver(\PEIP\INF\Event\Observer $observer){ |
|
67 | - foreach($this->observers as $key=>$obs){ |
|
68 | - if($obs == $observer){ |
|
66 | + public function deleteObserver(\PEIP\INF\Event\Observer $observer) { |
|
67 | + foreach ($this->observers as $key=>$obs) { |
|
68 | + if ($obs == $observer) { |
|
69 | 69 | unset($this->observers[$key]); |
70 | 70 | return true; |
71 | 71 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @param $arguments |
79 | 79 | * @return |
80 | 80 | */ |
81 | - public function notifyObservers(array $arguments = array()){ |
|
82 | - if($this->hasChanged()){ |
|
83 | - foreach($this->observers as $observer){ |
|
81 | + public function notifyObservers(array $arguments = array()) { |
|
82 | + if ($this->hasChanged()) { |
|
83 | + foreach ($this->observers as $observer) { |
|
84 | 84 | $observer->update($this->observedObject); |
85 | 85 | } |
86 | 86 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @access public |
92 | 92 | * @return |
93 | 93 | */ |
94 | - public function countObservers(){ |
|
94 | + public function countObservers() { |
|
95 | 95 | return count($this->obeservers); |
96 | 96 | } |
97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @access public |
101 | 101 | * @return |
102 | 102 | */ |
103 | - public function hasChanged(){ |
|
103 | + public function hasChanged() { |
|
104 | 104 | return $this->hasChanged(); |
105 | 105 | } |
106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @access public |
110 | 110 | * @return |
111 | 111 | */ |
112 | - public function setChanged(){ |
|
112 | + public function setChanged() { |
|
113 | 113 | $this->hasChanged = true; |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @access public |
119 | 119 | * @return |
120 | 120 | */ |
121 | - public function clearChanged(){ |
|
121 | + public function clearChanged() { |
|
122 | 122 | $this->hasChanged = true; |
123 | 123 | } |
124 | 124 |
@@ -23,11 +23,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -14,7 +14,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |