@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | //if(\PEIP\Util\Test::assertMessage($message)){ |
| 104 | 104 | if ($this->getOutputChannel()) { |
| 105 | 105 | $this->getOutputChannel()->send($message); |
| 106 | - } else { |
|
| 106 | + }else { |
|
| 107 | 107 | $this->doSend($message); |
| 108 | 108 | } |
| 109 | 109 | //} |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | public function command(\PEIP\INF\Message\Message $cmdMessage) |
| 196 | 196 | { |
| 197 | 197 | $this->doFireEvent(self::EVENT_PRE_COMMAND, [self::HEADER_MESSAGE => $cmdMessage]); |
| 198 | - $commandName = trim((string) $cmdMessage->getHeader('COMMAND')); |
|
| 198 | + $commandName = trim((string)$cmdMessage->getHeader('COMMAND')); |
|
| 199 | 199 | if ($commandName != '' && array_key_exists($commandName, $this->commands)) { |
| 200 | 200 | call_user_func($this->commands[$commandName], $cmdMessage->getContent()); |
| 201 | 201 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct($content, $title) |
| 37 | 37 | { |
| 38 | - $this->setContent((string) $content); |
|
| 38 | + $this->setContent((string)$content); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function setTitle($title) |
| 47 | 47 | { |
| 48 | - $this->title = (string) $title; |
|
| 48 | + $this->title = (string)$title; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getHeaders() |
| 84 | 84 | { |
| 85 | - return (array) $this->headers; |
|
| 85 | + return (array)$this->headers; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function getHeader($name) |
| 96 | 96 | { |
| 97 | - $name = (string) $name; |
|
| 97 | + $name = (string)$name; |
|
| 98 | 98 | |
| 99 | 99 | return isset($this->headers[$name]) ? $this->headers[$name] : null; |
| 100 | 100 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $res = false; |
| 141 | 141 | try { |
| 142 | - $res = (string) $this->getContent(); |
|
| 142 | + $res = (string)$this->getContent(); |
|
| 143 | 143 | } catch (\Exception $e) { |
| 144 | 144 | try { |
| 145 | 145 | $res = get_class($this->getContent()); |
@@ -41,17 +41,17 @@ |
||
| 41 | 41 | if (is_array($this->callable)) { |
| 42 | 42 | list($class, $method) = $this->callable; |
| 43 | 43 | $static = !is_object($class); |
| 44 | - $class = is_object($class) ? get_class($class) : (string) $class; |
|
| 44 | + $class = is_object($class) ? get_class($class) : (string)$class; |
|
| 45 | 45 | $reflectionClass = new \ReflectionClass($class); |
| 46 | 46 | $reflectionFunc = $reflectionClass->getMethod($method); |
| 47 | 47 | if ($static && !$reflectionFunc->isStatic()) { |
| 48 | 48 | throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not an Callable: Method "'.$method.'" of class '.$class.' is not static.'); |
| 49 | 49 | } |
| 50 | - } else { |
|
| 50 | + }else { |
|
| 51 | 51 | $reflectionFunc = new \ReflectionFunction($this->callable); |
| 52 | 52 | } |
| 53 | 53 | $this->requiredParameters = $reflectionFunc->getNumberOfRequiredParameters(); |
| 54 | - } else { |
|
| 54 | + }else { |
|
| 55 | 55 | throw new \InvalidArgumentException('Argument 1 passed to CallableMessageHandler::__construct is not a Callable'); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -28,12 +28,12 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function __toString() |
| 30 | 30 | { |
| 31 | - return (string) $this->getContent(); |
|
| 31 | + return (string)$this->getContent(); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function getContent() |
| 35 | 35 | { |
| 36 | - return (string) parent::getContent(); |
|
| 36 | + return (string)parent::getContent(); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $array = []; |
| 41 | 41 | $array['type'] = $node['type'] |
| 42 | - ? (string) $node['type'] |
|
| 43 | - : (string) $node->getName(); |
|
| 44 | - $value = (string) $node; |
|
| 42 | + ? (string)$node['type'] |
|
| 43 | + : (string)$node->getName(); |
|
| 44 | + $value = (string)$node; |
|
| 45 | 45 | if ($value != '') { |
| 46 | 46 | $array['value'] = $value; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | foreach ($node->attributes() as $name => $value) { |
| 50 | - $array[$name] = (string) $value; |
|
| 50 | + $array[$name] = (string)$value; |
|
| 51 | 51 | } |
| 52 | 52 | foreach ($node->children() as $nr => $child) { |
| 53 | 53 | $name = $child->getName(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ], |
| 63 | 63 | ]; |
| 64 | 64 | } |
| 65 | - } else { |
|
| 65 | + }else { |
|
| 66 | 66 | $array[$name] = []; |
| 67 | 67 | } |
| 68 | 68 | $array[$name][] = $res; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | if ($this->hasService($key)) { |
| 124 | 124 | $service = $this->getService($key); |
| 125 | - } else { |
|
| 125 | + }else { |
|
| 126 | 126 | $service = $this->createService($key); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | ]); |
| 156 | 156 | |
| 157 | 157 | return $node; |
| 158 | - } else { |
|
| 158 | + }else { |
|
| 159 | 159 | $errorMessage = 'COULD NOT BUILD NODE FOR KEY: '.$key; |
| 160 | 160 | } |
| 161 | - } else { |
|
| 161 | + }else { |
|
| 162 | 162 | $errorMessage = 'NO CONFIG FOR KEY: '.$key; |
| 163 | 163 | } |
| 164 | 164 | $this->doFireEvent(self::EVENT_CREATE_SERVICE_ERROR, [ |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | protected function buildNode($config) |
| 188 | 188 | { |
| 189 | - $nodeName = (string) $config['type']; |
|
| 189 | + $nodeName = (string)$config['type']; |
|
| 190 | 190 | |
| 191 | 191 | $this->doFireEvent(self::EVENT_BEFORE_BUILD_NODE, [ |
| 192 | 192 | self::HEADER_NODE_CONFIG => $config, |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | ]); |
| 204 | 204 | |
| 205 | 205 | return $nodeInstance; |
| 206 | - } else { |
|
| 206 | + }else { |
|
| 207 | 207 | $errorMessage = 'BUILDER RETURNED NO OBJECT FOR NODE-TYPE: '.$nodeName; |
| 208 | 208 | } |
| 209 | - } else { |
|
| 209 | + }else { |
|
| 210 | 210 | $errorMessage = 'NO BUILDER FOUND FOR NODE-TYPE: '.$nodeName; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | { |
| 222 | 222 | $id = ''; |
| 223 | 223 | if (isset($config[$this->idAttribute])) { |
| 224 | - $id = trim((string) ($config[$this->idAttribute])); |
|
| 224 | + $id = trim((string)($config[$this->idAttribute])); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | return $id; |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | public function setConstructor($method) |
| 73 | 73 | { |
| 74 | - $this->constructor = (string) $method; |
|
| 74 | + $this->constructor = (string)$method; |
|
| 75 | 75 | |
| 76 | 76 | return $this; |
| 77 | 77 | } |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public static function doBuild($config, $arguments, $defaultClass = false) |
| 53 | 53 | { |
| 54 | - $cls = isset($config['class']) ? trim((string) $config['class']) : (string) $defaultClass; |
|
| 54 | + $cls = isset($config['class']) ? trim((string)$config['class']) : (string)$defaultClass; |
|
| 55 | 55 | if ($cls != '') { |
| 56 | 56 | try { |
| 57 | - $constructor = isset($config['constructor']) ? (string) $config['constructor'] : ''; |
|
| 57 | + $constructor = isset($config['constructor']) ? (string)$config['constructor'] : ''; |
|
| 58 | 58 | if ($constructor != '' && Test::assertMethod($cls, $constructor)) { |
| 59 | 59 | $service = call_user_func_array([$cls, $constructor], $arguments); |
| 60 | - } else { |
|
| 60 | + }else { |
|
| 61 | 61 | $service = self::build($cls, $arguments); |
| 62 | 62 | } |
| 63 | 63 | } catch (\Exception $e) { |
@@ -95,18 +95,18 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected static function buildArg($config) |
| 97 | 97 | { |
| 98 | - if (trim((string) $config['value']) != '') { |
|
| 99 | - $arg = (string) $config['value']; |
|
| 98 | + if (trim((string)$config['value']) != '') { |
|
| 99 | + $arg = (string)$config['value']; |
|
| 100 | 100 | } elseif ($config->getName() == 'value') { |
| 101 | - $arg = (string) $config; |
|
| 101 | + $arg = (string)$config; |
|
| 102 | 102 | } elseif ($config->getName() == 'list') { |
| 103 | 103 | $arg = []; |
| 104 | 104 | foreach ($config->children() as $entry) { |
| 105 | 105 | if ($entry->getName() == 'value') { |
| 106 | 106 | if ($entry['key']) { |
| 107 | - $arg[(string) $entry['key']] = (string) $entry; |
|
| 108 | - } else { |
|
| 109 | - $arg[] = (string) $entry; |
|
| 107 | + $arg[(string)$entry['key']] = (string)$entry; |
|
| 108 | + }else { |
|
| 109 | + $arg[] = (string)$entry; |
|
| 110 | 110 | } |
| 111 | 111 | } elseif ($entry->getName() == 'service') { |
| 112 | 112 | $arg[] = $this->provideService($entry); |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public static function buildAndModify(array $config, $arguments, $defaultClass = '') |
| 140 | 140 | { |
| 141 | - if ((isset($config['class']) && '' != (string) $config['class']) || $defaultClass !== '') { |
|
| 141 | + if ((isset($config['class']) && '' != (string)$config['class']) || $defaultClass !== '') { |
|
| 142 | 142 | $service = self::doBuild($config, $arguments, $defaultClass); |
| 143 | - } else { |
|
| 143 | + }else { |
|
| 144 | 144 | throw new \RuntimeException('Could not create Service. no class or reference given.'); |
| 145 | 145 | } |
| 146 | 146 | if (isset($config['ref_property'])) { |
| 147 | - $service = $service->{(string) $config['ref_property']}; |
|
| 147 | + $service = $service->{(string)$config['ref_property']}; |
|
| 148 | 148 | } elseif (isset($config['ref_method'])) { |
| 149 | 149 | $args = []; |
| 150 | 150 | if (isset($config['argument'])) { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $args[] = self::buildArg($arg); |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | - $service = call_user_func_array([$service, (string) $config['ref_method']], $args); |
|
| 155 | + $service = call_user_func_array([$service, (string)$config['ref_method']], $args); |
|
| 156 | 156 | } |
| 157 | 157 | if (!is_object($service)) { |
| 158 | 158 | throw new \RuntimeException('Could not create Service.'); |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | // call instance methods |
| 196 | 196 | if (isset($config->action)) { |
| 197 | 197 | foreach ($config->action as $action) { |
| 198 | - $method = (string) $action['method'] != '' ? (string) $action['method'] : null; |
|
| 198 | + $method = (string)$action['method'] != '' ? (string)$action['method'] : null; |
|
| 199 | 199 | if ($method && self::hasPublicProperty($service, 'Method', $method)) { |
| 200 | 200 | $args = []; |
| 201 | 201 | foreach ($action->children() as $argument) { |
| 202 | 202 | $args[] = self::buildArg($argument); |
| 203 | 203 | } |
| 204 | - call_user_func_array([$service, (string) $action['method']], $args); |
|
| 204 | + call_user_func_array([$service, (string)$action['method']], $args); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | if ($service instanceof \PEIP\INF\Event\Connectable) { |
| 210 | 210 | if (isset($config->listener)) { |
| 211 | 211 | foreach ($config->listener as $listenerConf) { |
| 212 | - $event = (string) $listenerConf['event']; |
|
| 212 | + $event = (string)$listenerConf['event']; |
|
| 213 | 213 | $listener = $this->provideService($listenerConf); |
| 214 | 214 | $service->connect($event, $listener); |
| 215 | 215 | } |