@@ -64,7 +64,6 @@ |
||
64 | 64 | /** |
65 | 65 | * Disconnects all listeners. |
66 | 66 | * |
67 | - * @param callable|PEIP\INF\Handler\Handler $listener |
|
68 | 67 | * |
69 | 68 | * @return void |
70 | 69 | */ |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function hasListeners() |
82 | 82 | { |
83 | - return (bool) count($this->listeners); |
|
83 | + return (bool)count($this->listeners); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -98,7 +98,7 @@ |
||
98 | 98 | */ |
99 | 99 | public function setProcessed($processed) |
100 | 100 | { |
101 | - $this->processed = (bool) $processed; |
|
101 | + $this->processed = (bool)$processed; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | public static function assertClassHasConstructor($className) |
18 | 18 | { |
19 | - return (bool) ReflectionPool::getInstance($className)->getConstructor(); |
|
19 | + return (bool)ReflectionPool::getInstance($className)->getConstructor(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public static function assertRequiredConstructorParameters($className, $parameters) |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | public static function assertInstanceOf($className, $object) |
32 | 32 | { |
33 | - return (bool) ReflectionPool::getInstance($className) |
|
33 | + return (bool)ReflectionPool::getInstance($className) |
|
34 | 34 | ->isInstance($object); |
35 | 35 | } |
36 | 36 | |
37 | 37 | public static function assertClassOrInterfaceExists($className) |
38 | 38 | { |
39 | - return (bool) class_exists($className) || interface_exists($className); |
|
39 | + return (bool)class_exists($className) || interface_exists($className); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public static function assertImplements($className, $interfaceName) |
@@ -78,34 +78,34 @@ discard block |
||
78 | 78 | |
79 | 79 | public static function assertArrayAccess($var) |
80 | 80 | { |
81 | - return (bool) is_array($var) || $var instanceof \ArrayAccess; |
|
81 | + return (bool)is_array($var) || $var instanceof \ArrayAccess; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public static function assertHandler($var) |
85 | 85 | { |
86 | - return (bool) is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler; |
|
86 | + return (bool)is_callable($var) || $var instanceof \PEIP\INF\Handler\Handler; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public static function castType($var, $type) |
90 | 90 | { |
91 | 91 | switch ($type) { |
92 | 92 | case 'string': |
93 | - $var = (string) $var; |
|
93 | + $var = (string)$var; |
|
94 | 94 | break; |
95 | 95 | case 'integer': |
96 | - $var = (int) $var; |
|
96 | + $var = (int)$var; |
|
97 | 97 | break; |
98 | 98 | case 'float': |
99 | - $var = (float) $var; |
|
99 | + $var = (float)$var; |
|
100 | 100 | break; |
101 | 101 | case 'boolean': |
102 | - $var = (bool) $var; |
|
102 | + $var = (bool)$var; |
|
103 | 103 | break; |
104 | 104 | case 'object': |
105 | - $var = (object) $var; |
|
105 | + $var = (object)$var; |
|
106 | 106 | break; |
107 | 107 | case 'array': |
108 | - $var = (array) $var; |
|
108 | + $var = (array)$var; |
|
109 | 109 | break; |
110 | 110 | } |
111 | 111 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | $className = is_object($argument) |
29 | 29 | ? get_class($argument) |
30 | - : (string) $argument; |
|
30 | + : (string)$argument; |
|
31 | 31 | |
32 | 32 | return isset(self::$instances[$className]) |
33 | 33 | ? self::$instances[$className] |
@@ -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()) { |
@@ -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 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function doCreateChannel($config, $defaultChannelClass, array $additionalArguments = []) |
69 | 69 | { |
70 | - $id = (string) $config['id']; |
|
70 | + $id = (string)$config['id']; |
|
71 | 71 | if ($id != '') { |
72 | 72 | array_unshift($additionalArguments, $id); |
73 | 73 | $channel = $this->buildAndModify($config, $additionalArguments, $defaultChannelClass); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ]; |
96 | 96 | $defaultClass = $defaultClass ? $defaultClass : '\PEIP\Gateway\SimpleMessagingGateway'; |
97 | 97 | $gateway = $this->buildAndModify($config, $args, $defaultClass); |
98 | - $id = (string) $config['id']; |
|
98 | + $id = (string)$config['id']; |
|
99 | 99 | $this->gateways[$id] = $gateway; |
100 | 100 | |
101 | 101 | return $gateway; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function createRouter($config, $defaultClass = false) |
118 | 118 | { |
119 | - $resolver = $config['channel_resolver'] ? (string) $config['channel_resolver'] : $this->channelRegistry; |
|
119 | + $resolver = $config['channel_resolver'] ? (string)$config['channel_resolver'] : $this->channelRegistry; |
|
120 | 120 | |
121 | 121 | return $this->buildAndModify($config, [ |
122 | 122 | $resolver, |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function createServiceActivator($config, $defaultClass = false) |
213 | 213 | { |
214 | - $method = (string) $config['method']; |
|
215 | - $service = $this->context->getServiceProvider()->provideService((string) $config['ref']); |
|
214 | + $method = (string)$config['method']; |
|
215 | + $service = $this->context->getServiceProvider()->provideService((string)$config['ref']); |
|
216 | 216 | if ($method && $service) { |
217 | 217 | $args = $this->getReplyHandlerArguments($config); |
218 | 218 | array_unshift($args, [ |
@@ -287,6 +287,6 @@ discard block |
||
287 | 287 | ? $config[$type.'_channel'] |
288 | 288 | : $config['default_'.$type.'_channel']; |
289 | 289 | |
290 | - return $this->context->getServiceProvider()->provideService(trim((string) $channelName)); |
|
290 | + return $this->context->getServiceProvider()->provideService(trim((string)$channelName)); |
|
291 | 291 | } |
292 | 292 | } |