@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @implements \PEIP\INF\Context\Context |
143 | 143 | * @access public |
144 | - * @param \PEIP\INF\Context\Context_Plugin $plugin a plugin instance |
|
144 | + * @param \PEIP\INF\Context\ContextPlugin $plugin a plugin instance |
|
145 | 145 | */ |
146 | 146 | public function addPlugin(\PEIP\INF\Context\ContextPlugin $plugin){ |
147 | 147 | $plugin->init($this); |
@@ -173,7 +173,6 @@ discard block |
||
173 | 173 | * </config> |
174 | 174 | * |
175 | 175 | * @access public |
176 | - * @param XMLContext $config the config to include |
|
177 | 176 | */ |
178 | 177 | public function includeContext(XMLContext $context){ |
179 | 178 | $this->services = array_merge($this->services, $context->getServices()); |
@@ -184,7 +183,7 @@ discard block |
||
184 | 183 | * |
185 | 184 | * @see XMLContext::includeContext |
186 | 185 | * @access public |
187 | - * @param XMLContext $context the config to include |
|
186 | + * @param string $filePath |
|
188 | 187 | */ |
189 | 188 | public function includeContextFromFile($filePath){ |
190 | 189 | if(file_exists($filePath)){ |
@@ -363,7 +362,7 @@ discard block |
||
363 | 362 | * |
364 | 363 | * @access public |
365 | 364 | * @param $config |
366 | - * @return object the initialized service instance |
|
365 | + * @return \PEIP\INF\Context\ContextPlugin the initialized service instance |
|
367 | 366 | */ |
368 | 367 | public function createService(array $config){ |
369 | 368 | return ServiceFactory::createService($config); |
@@ -638,7 +637,7 @@ discard block |
||
638 | 637 | * |
639 | 638 | * @access protected |
640 | 639 | * @param object $config configuration object to create arguments from. |
641 | - * @return mixed build arguments |
|
640 | + * @return \PEIP\INF\Channel\Channel[] build arguments |
|
642 | 641 | */ |
643 | 642 | protected function getReplyHandlerArguments($config){ |
644 | 643 | $args = array( |
@@ -683,7 +682,8 @@ discard block |
||
683 | 682 | * |
684 | 683 | * @access protected |
685 | 684 | * @param string the configuration type ofthe channel (e.g.: 'reply', 'request') |
686 | - * @param object $config configuration object to return channel from. |
|
685 | + * @param object $config configuration object to return channel from. |
|
686 | + * @param string $type |
|
687 | 687 | * @return \PEIP\INF\Channel\Channel reply-channel |
688 | 688 | */ |
689 | 689 | public function doGetChannel($type, $config){ |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | * @see GenericBuilder |
738 | 738 | * @static |
739 | 739 | * @access protected |
740 | - * @param object $className name of class to build instance for. |
|
740 | + * @param string $className name of class to build instance for. |
|
741 | 741 | * @param array $arguments arguments for the constructor |
742 | 742 | * @return object build and modified srvice instance |
743 | 743 | */ |
@@ -133,7 +133,7 @@ |
||
133 | 133 | * @param callable $callable a callable which creates instances for node-name |
134 | 134 | */ |
135 | 135 | public function registerNodeBuilder($nodeName, $callable){ |
136 | - return $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable); |
|
136 | + return $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | * @param string $string the configuration string |
57 | 57 | * @return |
58 | 58 | */ |
59 | - public function __construct($string){ |
|
59 | + public function __construct($string) { |
|
60 | 60 | $this->initNodeBuilders(); |
61 | 61 | $reader = new XMLContextReader($string); |
62 | 62 | |
63 | 63 | |
64 | 64 | $serviceActivator = new HeaderServiceActivator(array($this, 'addConfig'), 'NODE'); |
65 | 65 | |
66 | - $reader->connect('read_node', $serviceActivator); |
|
66 | + $reader->connect('read_node', $serviceActivator); |
|
67 | 67 | $reader->read(); |
68 | 68 | |
69 | 69 | |
70 | 70 | } |
71 | 71 | |
72 | - public function addConfig($config){ |
|
72 | + public function addConfig($config) { |
|
73 | 73 | return $this->getServiceProvider()->addConfig($config); |
74 | 74 | } |
75 | 75 | |
76 | - public function handleReadConfig(\PEIP\INF\Event\Event $event){ |
|
76 | + public function handleReadConfig(\PEIP\INF\Event\Event $event) { |
|
77 | 77 | $this->addConfig($event->getHeader('NODE')); |
78 | 78 | } |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return XMLContext the context instance |
86 | 86 | * @throws RuntimeException |
87 | 87 | */ |
88 | - public static function createFromString($string){ |
|
88 | + public static function createFromString($string) { |
|
89 | 89 | return new XMLContext($string); |
90 | 90 | } |
91 | 91 | |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * @return XMLContext the context instance |
98 | 98 | * @throws RuntimeException |
99 | 99 | */ |
100 | - public static function createFromFile($file){ |
|
101 | - if(file_exists($file)){ |
|
100 | + public static function createFromFile($file) { |
|
101 | + if (file_exists($file)) { |
|
102 | 102 | return self::createFromString(file_get_contents($file)); |
103 | - }else{ |
|
103 | + }else { |
|
104 | 104 | throw new \RuntimeException('Cannot open file "'.$file.'".'); |
105 | 105 | } |
106 | 106 | } |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @access protected |
112 | 112 | * @return void |
113 | 113 | */ |
114 | - protected function init(){ |
|
114 | + protected function init() { |
|
115 | 115 | $xml = $this->simpleXML; |
116 | 116 | $this->channelRegistry = ChannelRegistry::getInstance(); |
117 | 117 | // register this context as a service if id is set. |
118 | - if($xml['id']){ |
|
118 | + if ($xml['id']) { |
|
119 | 119 | $this->services[(string)$xml['id']] = $this; |
120 | 120 | } |
121 | 121 | // build services |
122 | - foreach($xml->children() as $entry){ |
|
122 | + foreach ($xml->children() as $entry) { |
|
123 | 123 | $this->buildNode($entry); |
124 | 124 | } |
125 | 125 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param string $nodeName the name of the node |
133 | 133 | * @param callable $callable a callable which creates instances for node-name |
134 | 134 | */ |
135 | - public function registerNodeBuilder($nodeName, $callable){ |
|
135 | + public function registerNodeBuilder($nodeName, $callable) { |
|
136 | 136 | return $this->getServiceProvider()->registerNodeBuilder($nodeName, $callable); |
137 | 137 | } |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @access public |
144 | 144 | * @param \PEIP\INF\Context\Context_Plugin $plugin a plugin instance |
145 | 145 | */ |
146 | - public function addPlugin(\PEIP\INF\Context\ContextPlugin $plugin){ |
|
146 | + public function addPlugin(\PEIP\INF\Context\ContextPlugin $plugin) { |
|
147 | 147 | $plugin->init($this); |
148 | 148 | } |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param array $config configuration for the plugin |
155 | 155 | * @return |
156 | 156 | */ |
157 | - public function createPlugin(array $config){ |
|
157 | + public function createPlugin(array $config) { |
|
158 | 158 | $plugin = $this->createService($config); |
159 | 159 | $this->addPlugin($plugin); |
160 | 160 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @access public |
176 | 176 | * @param XMLContext $config the config to include |
177 | 177 | */ |
178 | - public function includeContext(XMLContext $context){ |
|
178 | + public function includeContext(XMLContext $context) { |
|
179 | 179 | $this->services = array_merge($this->services, $context->getServices()); |
180 | 180 | } |
181 | 181 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @access public |
187 | 187 | * @param XMLContext $context the config to include |
188 | 188 | */ |
189 | - public function includeContextFromFile($filePath){ |
|
190 | - if(file_exists($filePath)){ |
|
189 | + public function includeContextFromFile($filePath) { |
|
190 | + if (file_exists($filePath)) { |
|
191 | 191 | $this->includeContextFromString(file_get_contents($filePath)); |
192 | 192 | } |
193 | 193 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @access public |
200 | 200 | * @param string $configString the config to include |
201 | 201 | */ |
202 | - public function includeContextFromString($configString){ |
|
202 | + public function includeContextFromString($configString) { |
|
203 | 203 | $context = new XMLContext($configString); |
204 | 204 | $this->includeContext($context); |
205 | 205 | } |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | * @access protected |
212 | 212 | * @param object $config the configuration for the context |
213 | 213 | */ |
214 | - protected function createContext($config){ |
|
215 | - if((string)$config['file'] != ''){ |
|
214 | + protected function createContext($config) { |
|
215 | + if ((string)$config['file'] != '') { |
|
216 | 216 | $this->includeContextFromFile((string)$config['file']); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | - public function getServiceProvider(){ |
|
221 | + public function getServiceProvider() { |
|
222 | 222 | return isset($this->serviceProvider) |
223 | 223 | ? $this->serviceProvider |
224 | 224 | : $this->serviceProvider = new ServiceProvider(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @see XMLContext::includeContext |
235 | 235 | * @access protected |
236 | 236 | */ |
237 | - protected function initNodeBuilders(){ |
|
237 | + protected function initNodeBuilders() { |
|
238 | 238 | $builders = array( |
239 | 239 | 'include' => 'createContext', |
240 | 240 | 'plugin' => 'createPlugin', |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | ); |
253 | 253 | $plugin = new BasePlugin(); |
254 | 254 | $this->addPlugin($plugin); return; |
255 | - foreach($builders as $nodeName => $method){ |
|
255 | + foreach ($builders as $nodeName => $method) { |
|
256 | 256 | $this->registerNodeBuilder($nodeName, array($this, $method)); |
257 | 257 | } |
258 | 258 | } |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | * @param object $node configuration-node |
267 | 267 | * @return void |
268 | 268 | */ |
269 | - protected function buildNode($node){ |
|
269 | + protected function buildNode($node) { |
|
270 | 270 | $nodeName = $node->getName(); |
271 | 271 | // call the builder method registered for the node. |
272 | - if(array_key_exists($nodeName, $this->nodeBuilders)){ |
|
272 | + if (array_key_exists($nodeName, $this->nodeBuilders)) { |
|
273 | 273 | call_user_func($this->nodeBuilders[$nodeName], $node); |
274 | 274 | } |
275 | 275 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @param string $channelName the name/id of the channel to return |
289 | 289 | * @return \PEIP\INF\Channel\Channel |
290 | 290 | */ |
291 | - public function resolveChannelName($channelName){ |
|
291 | + public function resolveChannelName($channelName) { |
|
292 | 292 | return $this->channelRegistry->get($channelName); |
293 | 293 | } |
294 | 294 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param mixed $id the id for the service |
301 | 301 | * @return object the service instance if found |
302 | 302 | */ |
303 | - public function getService($id){ |
|
303 | + public function getService($id) { |
|
304 | 304 | return $this->getServiceProvider()->provideService($id); |
305 | 305 | } |
306 | 306 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @access public |
311 | 311 | * @return array registered services |
312 | 312 | */ |
313 | - public function getServices(){ |
|
313 | + public function getServices() { |
|
314 | 314 | return $this->getServiceProvider()->getServices(); |
315 | 315 | } |
316 | 316 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param mixed $id the id for the service |
322 | 322 | * @return boolean wether service is registered |
323 | 323 | */ |
324 | - public function hasService($id){ |
|
324 | + public function hasService($id) { |
|
325 | 325 | return isset($this->services[$id]); |
326 | 326 | } |
327 | 327 | |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * @return object the service instance if found |
336 | 336 | * |
337 | 337 | */ |
338 | - protected function requestService($id){ |
|
338 | + protected function requestService($id) { |
|
339 | 339 | $service = $this->getService($id); |
340 | - if($service === NULL){ |
|
340 | + if ($service === NULL) { |
|
341 | 341 | throw new \RuntimeException('Service "'.$id.'" not found.'); |
342 | 342 | } |
343 | 343 | return $service; |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | * @param object $config |
352 | 352 | * @return object the initialized service instance |
353 | 353 | */ |
354 | - protected function initService($config){ |
|
354 | + protected function initService($config) { |
|
355 | 355 | $id = trim((string)$config['id']); |
356 | - if($id != ''){ |
|
356 | + if ($id != '') { |
|
357 | 357 | return $this->services[$id] = $this->createService($config); |
358 | 358 | } |
359 | 359 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param $config |
366 | 366 | * @return object the initialized service instance |
367 | 367 | */ |
368 | - public function createService(array $config){ |
|
368 | + public function createService(array $config) { |
|
369 | 369 | return ServiceFactory::createService($config); |
370 | 370 | } |
371 | 371 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @param mixed $id the id ofthe gateway |
380 | 380 | * @return object the gateway instance |
381 | 381 | */ |
382 | - public function getGateway($id){ |
|
382 | + public function getGateway($id) { |
|
383 | 383 | return $this->getServiceProvider()->provideService($id); |
384 | 384 | } |
385 | 385 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @param object $config configuration object for the pollable channel. |
392 | 392 | * @return \PEIP\INF\Channel\Channel the created pollable channel instance |
393 | 393 | */ |
394 | - public function createChannel($config){ |
|
394 | + public function createChannel($config) { |
|
395 | 395 | return $this->doCreateChannel($config, 'PollableChannel'); |
396 | 396 | } |
397 | 397 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @param object $config configuration object for the subscribable channel. |
404 | 404 | * @return \PEIP\INF\Channel\Channel the created subscribable channel instance |
405 | 405 | */ |
406 | - public function createSubscribableChannel($config){ |
|
406 | + public function createSubscribableChannel($config) { |
|
407 | 407 | return $this->doCreateChannel($config, 'PublishSubscribeChannel'); |
408 | 408 | } |
409 | 409 | |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | * @param $additionalArguments additional arguments for the channel constructor (without first arg = id) |
417 | 417 | * @return \PEIP\INF\Channel\Channel the created channel instance |
418 | 418 | */ |
419 | - public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = array()){ |
|
419 | + public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = array()) { |
|
420 | 420 | $id = (string)$config['id']; |
421 | - if($id != ''){ |
|
421 | + if ($id != '') { |
|
422 | 422 | array_unshift($additionalArguments, $id); |
423 | 423 | $channel = ServiceFactory::buildAndModify($config, $additionalArguments, $defaultChannelClass); |
424 | 424 | $this->channelRegistry->register($channel); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @param string $defaultClass the class to use if none is set in config. |
436 | 436 | * @return object the gateway instance |
437 | 437 | */ |
438 | - public function createGateway($config, $defaultClass = false){ |
|
438 | + public function createGateway($config, $defaultClass = false) { |
|
439 | 439 | $args = array( |
440 | 440 | $this->getRequestChannel($config), |
441 | 441 | $this->getReplyChannel($config) |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param string $defaultClass the class to use if none is set in config. |
460 | 460 | * @return object the router instance |
461 | 461 | */ |
462 | - public function createRouter($config, $defaultClass = false){ |
|
462 | + public function createRouter($config, $defaultClass = false) { |
|
463 | 463 | $resolver = $config['channel_resolver'] ? (string)$config['channel_resolver'] : $this->channelRegistry; |
464 | 464 | return ServiceFactory::buildAndModify($config, array( |
465 | 465 | $resolver, |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @param object $config configuration object for the splitter. |
477 | 477 | * @return object the splitter instance |
478 | 478 | */ |
479 | - public function createSplitter($config){ |
|
479 | + public function createSplitter($config) { |
|
480 | 480 | return $this->createReplyMessageHandler($config); |
481 | 481 | } |
482 | 482 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @param object $config configuration object for the transformer. |
490 | 490 | * @return object the transformer instance |
491 | 491 | */ |
492 | - public function createTransformer($config){ |
|
492 | + public function createTransformer($config) { |
|
493 | 493 | return $this->createReplyMessageHandler($config); |
494 | 494 | } |
495 | 495 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param object $config configuration object for the aggregator. |
503 | 503 | * @return object the aggregator instance |
504 | 504 | */ |
505 | - public function createAggregator($config){ |
|
505 | + public function createAggregator($config) { |
|
506 | 506 | return $this->createReplyMessageHandler($config); |
507 | 507 | } |
508 | 508 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @param object $config configuration object for the wiretap. |
516 | 516 | * @return object the wiretap instance |
517 | 517 | */ |
518 | - public function createWiretap($config){ |
|
518 | + public function createWiretap($config) { |
|
519 | 519 | return $this->createReplyMessageHandler($config, 'Wiretap'); |
520 | 520 | } |
521 | 521 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | * @param string $defaultClass the class to use if none is set in config. |
529 | 529 | * @return object the reply-message-handler instance |
530 | 530 | */ |
531 | - public function createReplyMessageHandler($config, $defaultClass = false){ |
|
531 | + public function createReplyMessageHandler($config, $defaultClass = false) { |
|
532 | 532 | return ServiceFactory::buildAndModify($config, $this->getReplyHandlerArguments($config), $defaultClass); |
533 | 533 | } |
534 | 534 | |
@@ -541,12 +541,12 @@ discard block |
||
541 | 541 | * @param string $defaultClass the class to use if none is set in config. |
542 | 542 | * @return object the service-activator instance |
543 | 543 | */ |
544 | - public function createServiceActivator($config, $defaultClass = false){ |
|
544 | + public function createServiceActivator($config, $defaultClass = false) { |
|
545 | 545 | $method = (string)$config['method']; |
546 | 546 | $service = $this->getService((string)$config['ref']); |
547 | - if($method && $service){ |
|
547 | + if ($method && $service) { |
|
548 | 548 | $args = $this->getReplyHandlerArguments($config); |
549 | - array_unshift($args,array( |
|
549 | + array_unshift($args, array( |
|
550 | 550 | $service, |
551 | 551 | $method |
552 | 552 | )); |
@@ -567,11 +567,11 @@ discard block |
||
567 | 567 | * @param object $config configuration object for the service. |
568 | 568 | * @return |
569 | 569 | */ |
570 | - protected function provideService($config){ |
|
570 | + protected function provideService($config) { |
|
571 | 571 | $ref = trim((string)$config['ref']); |
572 | - if($ref != ''){ |
|
572 | + if ($ref != '') { |
|
573 | 573 | $service = $this->getService($ref); |
574 | - }else{ |
|
574 | + }else { |
|
575 | 575 | $service = $this->createService($config); |
576 | 576 | } |
577 | 577 | return $service; |
@@ -588,10 +588,10 @@ discard block |
||
588 | 588 | * @param object $config configuration object for the setter-method. |
589 | 589 | * @return string camel-cased |
590 | 590 | */ |
591 | - protected static function getSetter($config){ |
|
592 | - if($config['setter']){ |
|
591 | + protected static function getSetter($config) { |
|
592 | + if ($config['setter']) { |
|
593 | 593 | $setter = (string)$config['setter']; |
594 | - }elseif($config['name']){ |
|
594 | + }elseif ($config['name']) { |
|
595 | 595 | $setter = 'set'.ucfirst((string)$config['name']); |
596 | 596 | } |
597 | 597 | return $setter; |
@@ -604,29 +604,29 @@ discard block |
||
604 | 604 | * @param object $config configuration object to create argument from. |
605 | 605 | * @return mixed build argument |
606 | 606 | */ |
607 | - protected function buildArg($config){ |
|
608 | - if(trim((string)$config['value']) != ''){ |
|
607 | + protected function buildArg($config) { |
|
608 | + if (trim((string)$config['value']) != '') { |
|
609 | 609 | $arg = (string)$config['value']; |
610 | - }elseif($config->getName() == 'value'){ |
|
610 | + }elseif ($config->getName() == 'value') { |
|
611 | 611 | $arg = (string)$config; |
612 | - }elseif($config->getName() == 'list'){ |
|
612 | + }elseif ($config->getName() == 'list') { |
|
613 | 613 | $arg = array(); |
614 | - foreach($config->children() as $entry){ |
|
615 | - if($entry->getName() == 'value'){ |
|
616 | - if($entry['key']){ |
|
614 | + foreach ($config->children() as $entry) { |
|
615 | + if ($entry->getName() == 'value') { |
|
616 | + if ($entry['key']) { |
|
617 | 617 | $arg[(string)$entry['key']] = (string)$entry; |
618 | - }else{ |
|
618 | + }else { |
|
619 | 619 | $arg[] = (string)$entry; |
620 | 620 | } |
621 | - }elseif($entry->getName() == 'service'){ |
|
621 | + }elseif ($entry->getName() == 'service') { |
|
622 | 622 | $arg[] = $this->provideService($entry); |
623 | 623 | } |
624 | 624 | } |
625 | - }elseif($config->getName() == 'service'){ |
|
625 | + }elseif ($config->getName() == 'service') { |
|
626 | 626 | $arg = $this->provideService($config); |
627 | - }elseif($config->list){ |
|
627 | + }elseif ($config->list) { |
|
628 | 628 | $arg = $this->buildArg($config->list); |
629 | - }elseif($config->service){ |
|
629 | + }elseif ($config->service) { |
|
630 | 630 | $arg = $this->buildArg($config->service); |
631 | 631 | } |
632 | 632 | return $arg; |
@@ -640,12 +640,12 @@ discard block |
||
640 | 640 | * @param object $config configuration object to create arguments from. |
641 | 641 | * @return mixed build arguments |
642 | 642 | */ |
643 | - protected function getReplyHandlerArguments($config){ |
|
643 | + protected function getReplyHandlerArguments($config) { |
|
644 | 644 | $args = array( |
645 | 645 | $this->doGetChannel('input', $config), |
646 | 646 | $this->doGetChannel('output', $config) |
647 | 647 | ); |
648 | - if($args[0] == NULL){ |
|
648 | + if ($args[0] == NULL) { |
|
649 | 649 | throw new \RuntimeException('Could not receive input channel.'); |
650 | 650 | } |
651 | 651 | return $args; |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | * @param object $config configuration object to return request-channel from. |
661 | 661 | * @return \PEIP\INF\Channel\Channel request-channel |
662 | 662 | */ |
663 | - protected function getRequestChannel($config){ |
|
663 | + protected function getRequestChannel($config) { |
|
664 | 664 | return $this->doGetChannel('request', $config); |
665 | 665 | } |
666 | 666 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | * @param object $config configuration object to return reply-channel from. |
674 | 674 | * @return \PEIP\INF\Channel\Channel reply-channel |
675 | 675 | */ |
676 | - protected function getReplyChannel($config){ |
|
676 | + protected function getReplyChannel($config) { |
|
677 | 677 | return $this->doGetChannel('reply', $config); |
678 | 678 | } |
679 | 679 | |
@@ -686,15 +686,15 @@ discard block |
||
686 | 686 | * @param object $config configuration object to return channel from. |
687 | 687 | * @return \PEIP\INF\Channel\Channel reply-channel |
688 | 688 | */ |
689 | - public function doGetChannel($type, $config){ |
|
689 | + public function doGetChannel($type, $config) { |
|
690 | 690 | $channelName = $config[$type."_channel"] |
691 | 691 | ? $config[$type."_channel"] |
692 | 692 | : $config["default_".$type."_channel"]; |
693 | 693 | return $this->serviceProvider->provideService(trim((string)$channelName)); |
694 | - $channel = $this->services[trim((string)$channelName)]; |
|
695 | - if($channel instanceof \PEIP\INF\Channel\Channel){ |
|
694 | + $channel = $this->services[trim((string)$channelName)]; |
|
695 | + if ($channel instanceof \PEIP\INF\Channel\Channel) { |
|
696 | 696 | return $channel; |
697 | - }else{ |
|
697 | + }else { |
|
698 | 698 | return NULL; |
699 | 699 | } |
700 | 700 | } |
@@ -711,21 +711,21 @@ discard block |
||
711 | 711 | * @param string $defaultClass class to create instance for if none is set in config |
712 | 712 | * @return object build and modified srvice instance |
713 | 713 | */ |
714 | - protected static function doBuild($config, $arguments, $defaultClass = false){ |
|
714 | + protected static function doBuild($config, $arguments, $defaultClass = false) { |
|
715 | 715 | $cls = $config["class"] ? trim((string)$config["class"]) : (string)$defaultClass; |
716 | - if($cls != ''){ |
|
716 | + if ($cls != '') { |
|
717 | 717 | try { |
718 | 718 | $constructor = (string)$config["constructor"]; |
719 | - if($constructor != ''){ |
|
719 | + if ($constructor != '') { |
|
720 | 720 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
721 | - }else{ |
|
721 | + }else { |
|
722 | 722 | $service = self::build($cls, $arguments); |
723 | 723 | } |
724 | - }catch(\Exception $e){ |
|
724 | + } catch (\Exception $e) { |
|
725 | 725 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage()); |
726 | 726 | } |
727 | 727 | } |
728 | - if(is_object($service)){ |
|
728 | + if (is_object($service)) { |
|
729 | 729 | return $service; |
730 | 730 | } |
731 | 731 | throw new \RuntimeException('Could not create Service "'.$cls.'". Class does not exist.'); |
@@ -741,13 +741,13 @@ discard block |
||
741 | 741 | * @param array $arguments arguments for the constructor |
742 | 742 | * @return object build and modified srvice instance |
743 | 743 | */ |
744 | - protected static function build($className, $arguments){ |
|
744 | + protected static function build($className, $arguments) { |
|
745 | 745 | return GenericBuilder::getInstance($className)->build($arguments); |
746 | 746 | } |
747 | 747 | |
748 | - protected static function hasPublicProperty($service, $type, $name){ |
|
748 | + protected static function hasPublicProperty($service, $type, $name) { |
|
749 | 749 | $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass(); |
750 | - if($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()){ |
|
750 | + if ($reflection->{'has'.$type}($name) && $reflection->{'get'.$type}($name)->isPublic()) { |
|
751 | 751 | return true; |
752 | 752 | } |
753 | 753 | return false; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public static function createFromFile($file){ |
101 | 101 | if(file_exists($file)){ |
102 | 102 | return self::createFromString(file_get_contents($file)); |
103 | - }else{ |
|
103 | + } else{ |
|
104 | 104 | throw new \RuntimeException('Cannot open file "'.$file.'".'); |
105 | 105 | } |
106 | 106 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $ref = trim((string)$config['ref']); |
572 | 572 | if($ref != ''){ |
573 | 573 | $service = $this->getService($ref); |
574 | - }else{ |
|
574 | + } else{ |
|
575 | 575 | $service = $this->createService($config); |
576 | 576 | } |
577 | 577 | return $service; |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | protected static function getSetter($config){ |
592 | 592 | if($config['setter']){ |
593 | 593 | $setter = (string)$config['setter']; |
594 | - }elseif($config['name']){ |
|
594 | + } elseif($config['name']){ |
|
595 | 595 | $setter = 'set'.ucfirst((string)$config['name']); |
596 | 596 | } |
597 | 597 | return $setter; |
@@ -607,26 +607,26 @@ discard block |
||
607 | 607 | protected function buildArg($config){ |
608 | 608 | if(trim((string)$config['value']) != ''){ |
609 | 609 | $arg = (string)$config['value']; |
610 | - }elseif($config->getName() == 'value'){ |
|
610 | + } elseif($config->getName() == 'value'){ |
|
611 | 611 | $arg = (string)$config; |
612 | - }elseif($config->getName() == 'list'){ |
|
612 | + } elseif($config->getName() == 'list'){ |
|
613 | 613 | $arg = array(); |
614 | 614 | foreach($config->children() as $entry){ |
615 | 615 | if($entry->getName() == 'value'){ |
616 | 616 | if($entry['key']){ |
617 | 617 | $arg[(string)$entry['key']] = (string)$entry; |
618 | - }else{ |
|
618 | + } else{ |
|
619 | 619 | $arg[] = (string)$entry; |
620 | 620 | } |
621 | - }elseif($entry->getName() == 'service'){ |
|
621 | + } elseif($entry->getName() == 'service'){ |
|
622 | 622 | $arg[] = $this->provideService($entry); |
623 | 623 | } |
624 | 624 | } |
625 | - }elseif($config->getName() == 'service'){ |
|
625 | + } elseif($config->getName() == 'service'){ |
|
626 | 626 | $arg = $this->provideService($config); |
627 | - }elseif($config->list){ |
|
627 | + } elseif($config->list){ |
|
628 | 628 | $arg = $this->buildArg($config->list); |
629 | - }elseif($config->service){ |
|
629 | + } elseif($config->service){ |
|
630 | 630 | $arg = $this->buildArg($config->service); |
631 | 631 | } |
632 | 632 | return $arg; |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | $channel = $this->services[trim((string)$channelName)]; |
695 | 695 | if($channel instanceof \PEIP\INF\Channel\Channel){ |
696 | 696 | return $channel; |
697 | - }else{ |
|
697 | + } else{ |
|
698 | 698 | return NULL; |
699 | 699 | } |
700 | 700 | } |
@@ -718,10 +718,10 @@ discard block |
||
718 | 718 | $constructor = (string)$config["constructor"]; |
719 | 719 | if($constructor != ''){ |
720 | 720 | $service = call_user_func_array(array($cls, $constructor), $arguments); |
721 | - }else{ |
|
721 | + } else{ |
|
722 | 722 | $service = self::build($cls, $arguments); |
723 | 723 | } |
724 | - }catch(\Exception $e){ |
|
724 | + } catch(\Exception $e){ |
|
725 | 725 | throw new \RuntimeException('Could not create Service "'.$cls.'" -> '.$e->getMessage()); |
726 | 726 | } |
727 | 727 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | * |
12 | 12 | * @author timo |
13 | 13 | */ |
14 | -use PEIP\Util\Reflection; |
|
15 | -use PEIP\Util\ReflectionPool; |
|
14 | +use PEIP\Util\Reflection; |
|
15 | +use PEIP\Util\ReflectionPool; |
|
16 | 16 | use PEIP\Event\EventBuilder; |
17 | 17 | |
18 | 18 | class ClassEventDispatcher extends \PEIP\Dispatcher\ObjectEventDispatcher { |
@@ -16,13 +16,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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($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,30 +166,30 @@ discard block |
||
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 | $config = is_array($config) ? new \ArrayObject($config) : $config; |
171 | 171 | $reflection = GenericBuilder::getInstance(get_class($service))->getReflectionClass(); |
172 | 172 | // set instance properties |
173 | - if(isset($config->property)){ |
|
174 | - foreach($config->property as $property){ |
|
173 | + if (isset($config->property)) { |
|
174 | + foreach ($config->property as $property) { |
|
175 | 175 | $arg = $this->buildArg($property); |
176 | - if($arg){ |
|
176 | + if ($arg) { |
|
177 | 177 | $setter = self::getSetter($property); |
178 | - if($setter && self::hasPublicProperty($service, 'Method', $setter)){ |
|
178 | + if ($setter && self::hasPublicProperty($service, 'Method', $setter)) { |
|
179 | 179 | $service->{$setter}($arg); |
180 | - }elseif(in_array($property, self::hasPublicProperty($service, 'Property', $setter))){ |
|
180 | + }elseif (in_array($property, self::hasPublicProperty($service, 'Property', $setter))) { |
|
181 | 181 | $service->$setter = $arg; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | // call instance methods |
187 | - if(isset($config->action)){ |
|
188 | - foreach($config->action as $action){ |
|
187 | + if (isset($config->action)) { |
|
188 | + foreach ($config->action as $action) { |
|
189 | 189 | $method = (string)$action['method'] != '' ? (string)$action['method'] : NULL; |
190 | - if($method && self::hasPublicProperty($service, 'Method', $method)){ |
|
190 | + if ($method && self::hasPublicProperty($service, 'Method', $method)) { |
|
191 | 191 | $args = array(); |
192 | - foreach($action->children() as $argument){ |
|
192 | + foreach ($action->children() as $argument) { |
|
193 | 193 | $args[] = $this->buildArg($argument); |
194 | 194 | } |
195 | 195 | call_user_func_array(array($service, (string)$action['method']), $args); |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | // register instance listeners |
200 | - if($service instanceof \PEIP\INF\Event\Connectable){ |
|
201 | - if(isset($config->listener)){ |
|
202 | - foreach($config->listener as $listenerConf){ |
|
200 | + if ($service instanceof \PEIP\INF\Event\Connectable) { |
|
201 | + if (isset($config->listener)) { |
|
202 | + foreach ($config->listener as $listenerConf) { |
|
203 | 203 | $event = (string)$listenerConf['event']; |
204 | 204 | $listener = $this->provideService($listenerConf); |
205 | 205 | $service->connect($event, $listener); |
@@ -49,10 +49,10 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * @access public |
|
53 | - * @param $observer |
|
54 | - * @return |
|
55 | - */ |
|
52 | + * @access public |
|
53 | + * @param $observer |
|
54 | + * @return |
|
55 | + */ |
|
56 | 56 | public function addObserver(\PEIP\INF\Event\Observer $observer){ |
57 | 57 | $this->observers[] = $observer; |
58 | 58 | } |
@@ -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 |