@@ -32,13 +32,13 @@ |
||
32 | 32 | |
33 | 33 | public static function getImplementedClassesAndInterfaces($class, $store = true) |
34 | 34 | { |
35 | - $class = is_object($class) ? get_class($class) : (string) $class; |
|
35 | + $class = is_object($class) ? get_class($class) : (string)$class; |
|
36 | 36 | if (isset(self::$classInfo[$class])) { |
37 | 37 | return self::$classInfo[$class]; |
38 | 38 | } |
39 | 39 | $cls = ReflectionPool::getInstance($class); |
40 | 40 | // get the names of implemented interfaces |
41 | - $classInfo = (array) $cls->getInterfaceNames(); |
|
41 | + $classInfo = (array)$cls->getInterfaceNames(); |
|
42 | 42 | $classInfo[] = $cls->getName(); |
43 | 43 | // get names of parent-classes |
44 | 44 | while ($cls = $cls->getParentClass()) { |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $store = $this->factory->build(); |
55 | 55 | if ($store instanceof \PEIP\INF\Data\Store) { |
56 | 56 | $this->setPrivateValue($namespace, $store); |
57 | - } else { |
|
57 | + }else { |
|
58 | 58 | throw new \Exception('Could not build Instance of \PEIP\INF\Data\Store from factory.'); |
59 | 59 | } |
60 | 60 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | if (file_exists($file)) { |
99 | 99 | return self::createFromString(file_get_contents($file)); |
100 | - } else { |
|
100 | + }else { |
|
101 | 101 | throw new \RuntimeException('Cannot open file "'.$file.'".'); |
102 | 102 | } |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->channelRegistry = ChannelRegistry::getInstance(); |
114 | 114 | // register this context as a service if id is set. |
115 | 115 | if ($xml['id']) { |
116 | - $this->services[(string) $xml['id']] = $this; |
|
116 | + $this->services[(string)$xml['id']] = $this; |
|
117 | 117 | } |
118 | 118 | // build services |
119 | 119 | foreach ($xml->children() as $entry) { |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | */ |
214 | 214 | protected function createContext($config) |
215 | 215 | { |
216 | - if ((string) $config['file'] != '') { |
|
217 | - $this->includeContextFromFile((string) $config['file']); |
|
216 | + if ((string)$config['file'] != '') { |
|
217 | + $this->includeContextFromFile((string)$config['file']); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | protected function initService($config) |
365 | 365 | { |
366 | - $id = trim((string) $config['id']); |
|
366 | + $id = trim((string)$config['id']); |
|
367 | 367 | if ($id != '') { |
368 | 368 | return $this->services[$id] = $this->createService($config); |
369 | 369 | } |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | // call instance methods |
414 | 414 | if ($config->action) { |
415 | 415 | foreach ($config->action as $action) { |
416 | - $method = (string) $action['method'] != '' ? (string) $action['method'] : null; |
|
416 | + $method = (string)$action['method'] != '' ? (string)$action['method'] : null; |
|
417 | 417 | if ($method && self::hasPublicProperty($service, 'Method', $method)) { |
418 | 418 | $args = []; |
419 | 419 | foreach ($action->children() as $argument) { |
420 | 420 | $args[] = $this->buildArg($argument); |
421 | 421 | } |
422 | - call_user_func_array([$service, (string) $action['method']], $args); |
|
422 | + call_user_func_array([$service, (string)$action['method']], $args); |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | if ($service instanceof \PEIP\INF\Event\Connectable) { |
428 | 428 | if ($config->listener) { |
429 | 429 | foreach ($config->listener as $listenerConf) { |
430 | - $event = (string) $listenerConf['event']; |
|
430 | + $event = (string)$listenerConf['event']; |
|
431 | 431 | $listener = $this->provideService($listenerConf); |
432 | 432 | $service->connect($event, $listener); |
433 | 433 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | */ |
492 | 492 | public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = []) |
493 | 493 | { |
494 | - $id = (string) $config['id']; |
|
494 | + $id = (string)$config['id']; |
|
495 | 495 | if ($id != '') { |
496 | 496 | array_unshift($additionalArguments, $id); |
497 | 497 | $channel = $this->buildAndModify($config, $additionalArguments, $defaultChannelClass); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | ]; |
520 | 520 | $defaultClass = $defaultClass ? $defaultClass : 'SimpleMessagingGateway'; |
521 | 521 | $gateway = $this->buildAndModify($config, $args, $defaultClass); |
522 | - $id = (string) $config['id']; |
|
522 | + $id = (string)$config['id']; |
|
523 | 523 | $this->gateways[$id] = $gateway; |
524 | 524 | |
525 | 525 | return $gateway; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | */ |
541 | 541 | public function createRouter($config, $defaultClass = false) |
542 | 542 | { |
543 | - $resolver = $config['channel_resolver'] ? (string) $config['channel_resolver'] : $this->channelRegistry; |
|
543 | + $resolver = $config['channel_resolver'] ? (string)$config['channel_resolver'] : $this->channelRegistry; |
|
544 | 544 | |
545 | 545 | return $this->buildAndModify($config, [ |
546 | 546 | $resolver, |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | */ |
636 | 636 | public function createServiceActivator($config, $defaultClass = false) |
637 | 637 | { |
638 | - $method = (string) $config['method']; |
|
639 | - $service = $this->getService((string) $config['ref']); |
|
638 | + $method = (string)$config['method']; |
|
639 | + $service = $this->getService((string)$config['ref']); |
|
640 | 640 | if ($method && $service) { |
641 | 641 | $args = $this->getReplyHandlerArguments($config); |
642 | 642 | array_unshift($args, [ |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | */ |
664 | 664 | protected function provideService($config) |
665 | 665 | { |
666 | - $ref = trim((string) $config['ref']); |
|
666 | + $ref = trim((string)$config['ref']); |
|
667 | 667 | if ($ref != '') { |
668 | 668 | $service = $this->getService($ref); |
669 | - } else { |
|
669 | + }else { |
|
670 | 670 | $service = $this->createService($config); |
671 | 671 | } |
672 | 672 | |
@@ -688,9 +688,9 @@ discard block |
||
688 | 688 | protected static function getSetter($config) |
689 | 689 | { |
690 | 690 | if ($config['setter']) { |
691 | - $setter = (string) $config['setter']; |
|
691 | + $setter = (string)$config['setter']; |
|
692 | 692 | } elseif ($config['name']) { |
693 | - $setter = 'set'.ucfirst((string) $config['name']); |
|
693 | + $setter = 'set'.ucfirst((string)$config['name']); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | return $setter; |
@@ -705,18 +705,18 @@ discard block |
||
705 | 705 | */ |
706 | 706 | protected function buildArg($config) |
707 | 707 | { |
708 | - if (trim((string) $config['value']) != '') { |
|
709 | - $arg = (string) $config['value']; |
|
708 | + if (trim((string)$config['value']) != '') { |
|
709 | + $arg = (string)$config['value']; |
|
710 | 710 | } elseif ($config->getName() == 'value') { |
711 | - $arg = (string) $config; |
|
711 | + $arg = (string)$config; |
|
712 | 712 | } elseif ($config->getName() == 'list') { |
713 | 713 | $arg = []; |
714 | 714 | foreach ($config->children() as $entry) { |
715 | 715 | if ($entry->getName() == 'value') { |
716 | 716 | if ($entry['key']) { |
717 | - $arg[(string) $entry['key']] = (string) $entry; |
|
718 | - } else { |
|
719 | - $arg[] = (string) $entry; |
|
717 | + $arg[(string)$entry['key']] = (string)$entry; |
|
718 | + }else { |
|
719 | + $arg[] = (string)$entry; |
|
720 | 720 | } |
721 | 721 | } elseif ($entry->getName() == 'service') { |
722 | 722 | $arg[] = $this->provideService($entry); |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | ? $config[$type.'_channel'] |
797 | 797 | : $config['default_'.$type.'_channel']; |
798 | 798 | |
799 | - return $this->serviceProvider->provideService(trim((string) $channelName)); |
|
799 | + return $this->serviceProvider->provideService(trim((string)$channelName)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
@@ -830,13 +830,13 @@ discard block |
||
830 | 830 | */ |
831 | 831 | protected static function doBuild($config, $arguments, $defaultClass = false) |
832 | 832 | { |
833 | - $cls = $config['class'] ? trim((string) $config['class']) : (string) $defaultClass; |
|
833 | + $cls = $config['class'] ? trim((string)$config['class']) : (string)$defaultClass; |
|
834 | 834 | if ($cls != '') { |
835 | 835 | try { |
836 | - $constructor = (string) $config['constructor']; |
|
836 | + $constructor = (string)$config['constructor']; |
|
837 | 837 | if ($constructor != '') { |
838 | 838 | $service = call_user_func_array([$cls, $constructor], $arguments); |
839 | - } else { |
|
839 | + }else { |
|
840 | 840 | $service = self::build($cls, $arguments); |
841 | 841 | } |
842 | 842 | } catch (\Exception $e) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct(\SplObjectStorage $store = null) |
40 | 40 | { |
41 | - $this->store = (bool) $store ? $store : new ObjectStorage(); |
|
41 | + $this->store = (bool)$store ? $store : new ObjectStorage(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function seal($value, $box = false) |
56 | 56 | { |
57 | - $box = (bool) $box ? $box : new \stdClass(); |
|
57 | + $box = (bool)$box ? $box : new \stdClass(); |
|
58 | 58 | $this->store[$box] = $value; |
59 | 59 | |
60 | 60 | return $box; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | */ |
68 | 68 | public static function getInstance($className) |
69 | 69 | { |
70 | - if (!array_key_exists((string) $className, self::$instances)) { |
|
70 | + if (!array_key_exists((string)$className, self::$instances)) { |
|
71 | 71 | new self($className); |
72 | 72 | } |
73 | 73 |
@@ -104,7 +104,7 @@ |
||
104 | 104 | $listners = $this->doGetListeners(); |
105 | 105 | if (!$this->hadListeners($name, $object)) { |
106 | 106 | $res = false; |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $listners = $this->doGetListeners(); |
109 | 109 | $res = (boolean)count($listners[$object][$name]); |
110 | 110 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($capacity = -1, $priorityHeader = null) |
38 | 38 | { |
39 | - $this->setCapacity((int) $capacity); |
|
39 | + $this->setCapacity((int)$capacity); |
|
40 | 40 | $this->queue = new SplPriorityQueue(); |
41 | 41 | if ($priorityHeader) { |
42 | 42 | $this->priorityHeader = $priorityHeader; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | if ($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()) { |
54 | 54 | $this->queue->insert($message, $message->getHeader($this->priorityHeader)); |
55 | - } else { |
|
55 | + }else { |
|
56 | 56 | throw new \Exception('Not implemented yet.'); |
57 | 57 | } |
58 | 58 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function __construct($capacity = -1) |
33 | 33 | { |
34 | - $this->setCapacity((int) $capacity); |
|
34 | + $this->setCapacity((int)$capacity); |
|
35 | 35 | $this->queue = new SplQueue(); |
36 | 36 | } |
37 | 37 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | if ($this->capacity < 1 || $this->getMessageCount() <= $this->getCapacity()) { |
72 | 72 | $this->queue->enqueque($message); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | throw new \Exception('Not implemented yet.'); |
75 | 75 | } |
76 | 76 | } |
@@ -104,7 +104,7 @@ |
||
104 | 104 | $listners = $this->doGetListeners(); |
105 | 105 | if (!$this->hadListeners($name, $object)) { |
106 | 106 | $res = false; |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $listners = $this->doGetListeners(); |
109 | 109 | $res = (boolean)count($listners[$object][$name]); |
110 | 110 | } |