@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function isCLI(): bool |
| 26 | 26 | { |
| 27 | - if (!empty(getenv('RR'))) { |
|
| 27 | + if (!empty(getenv('RR'))){ |
|
| 28 | 28 | // Do not treat RoadRunner as CLI. |
| 29 | 29 | return false; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if (php_sapi_name() === 'cli') { |
|
| 32 | + if (php_sapi_name() === 'cli'){ |
|
| 33 | 33 | return true; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public static function isColorsSupported($stream = STDOUT): bool |
| 48 | 48 | { |
| 49 | - if ('Hyper' === getenv('TERM_PROGRAM')) { |
|
| 49 | + if ('Hyper' === getenv('TERM_PROGRAM')){ |
|
| 50 | 50 | return true; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - try { |
|
| 54 | - if (\DIRECTORY_SEPARATOR === '\\') { |
|
| 53 | + try{ |
|
| 54 | + if (\DIRECTORY_SEPARATOR === '\\'){ |
|
| 55 | 55 | return ( |
| 56 | 56 | function_exists('sapi_windows_vt100_support') |
| 57 | 57 | && @sapi_windows_vt100_support($stream) |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | || getenv('TERM') == 'xterm'; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if (\function_exists('stream_isatty')) { |
|
| 63 | + if (\function_exists('stream_isatty')){ |
|
| 64 | 64 | return @stream_isatty($stream); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if (\function_exists('posix_isatty')) { |
|
| 67 | + if (\function_exists('posix_isatty')){ |
|
| 68 | 68 | return @posix_isatty($stream); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // Check if formatted mode is S_IFCHR |
| 74 | 74 | return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; |
| 75 | - } catch (\Throwable $e) { |
|
| 75 | + }catch (\Throwable $e){ |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -24,12 +24,14 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function isCLI(): bool |
| 26 | 26 | { |
| 27 | - if (!empty(getenv('RR'))) { |
|
| 27 | + if (!empty(getenv('RR'))) |
|
| 28 | + { |
|
| 28 | 29 | // Do not treat RoadRunner as CLI. |
| 29 | 30 | return false; |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | - if (php_sapi_name() === 'cli') { |
|
| 33 | + if (php_sapi_name() === 'cli') |
|
| 34 | + { |
|
| 33 | 35 | return true; |
| 34 | 36 | } |
| 35 | 37 | |
@@ -46,12 +48,15 @@ discard block |
||
| 46 | 48 | */ |
| 47 | 49 | public static function isColorsSupported($stream = STDOUT): bool |
| 48 | 50 | { |
| 49 | - if ('Hyper' === getenv('TERM_PROGRAM')) { |
|
| 51 | + if ('Hyper' === getenv('TERM_PROGRAM')) |
|
| 52 | + { |
|
| 50 | 53 | return true; |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | - try { |
|
| 54 | - if (\DIRECTORY_SEPARATOR === '\\') { |
|
| 56 | + try |
|
| 57 | + { |
|
| 58 | + if (\DIRECTORY_SEPARATOR === '\\') |
|
| 59 | + { |
|
| 55 | 60 | return ( |
| 56 | 61 | function_exists('sapi_windows_vt100_support') |
| 57 | 62 | && @sapi_windows_vt100_support($stream) |
@@ -60,11 +65,13 @@ discard block |
||
| 60 | 65 | || getenv('TERM') == 'xterm'; |
| 61 | 66 | } |
| 62 | 67 | |
| 63 | - if (\function_exists('stream_isatty')) { |
|
| 68 | + if (\function_exists('stream_isatty')) |
|
| 69 | + { |
|
| 64 | 70 | return @stream_isatty($stream); |
| 65 | 71 | } |
| 66 | 72 | |
| 67 | - if (\function_exists('posix_isatty')) { |
|
| 73 | + if (\function_exists('posix_isatty')) |
|
| 74 | + { |
|
| 68 | 75 | return @posix_isatty($stream); |
| 69 | 76 | } |
| 70 | 77 | |
@@ -72,7 +79,9 @@ discard block |
||
| 72 | 79 | |
| 73 | 80 | // Check if formatted mode is S_IFCHR |
| 74 | 81 | return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; |
| 75 | - } catch (\Throwable $e) { |
|
| 82 | + } |
|
| 83 | + catch (\Throwable $e) |
|
| 84 | + { |
|
| 76 | 85 | return false; |
| 77 | 86 | } |
| 78 | 87 | } |
@@ -58,7 +58,8 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function __construct(LoggerInterface $logger = null) |
| 60 | 60 | { |
| 61 | - if (!empty($logger)) { |
|
| 61 | + if (!empty($logger)) |
|
| 62 | + { |
|
| 62 | 63 | $this->setLogger($logger); |
| 63 | 64 | } |
| 64 | 65 | } |
@@ -86,7 +87,8 @@ discard block |
||
| 86 | 87 | $r = $this->getRenderer($target); |
| 87 | 88 | $dump = $r->wrapContent($this->renderValue($r, $value)); |
| 88 | 89 | |
| 89 | - switch ($target) { |
|
| 90 | + switch ($target) |
|
| 91 | + { |
|
| 90 | 92 | case self::OUTPUT: |
| 91 | 93 | echo $dump; |
| 92 | 94 | break; |
@@ -95,7 +97,8 @@ discard block |
||
| 95 | 97 | return $dump; |
| 96 | 98 | |
| 97 | 99 | case self::LOGGER: |
| 98 | - if ($this->logger == null) { |
|
| 100 | + if ($this->logger == null) |
|
| 101 | + { |
|
| 99 | 102 | throw new DumperException('Unable to dump value to log, no associated LoggerInterface'); |
| 100 | 103 | } |
| 101 | 104 | $this->logger->debug($dump); |
@@ -119,7 +122,8 @@ discard block |
||
| 119 | 122 | */ |
| 120 | 123 | public function setRenderer(int $target, RendererInterface $renderer): Dumper |
| 121 | 124 | { |
| 122 | - if (!isset($this->targets[$target])) { |
|
| 125 | + if (!isset($this->targets[$target])) |
|
| 126 | + { |
|
| 123 | 127 | throw new DumperException(sprintf('Undefined dump target %d', $target)); |
| 124 | 128 | } |
| 125 | 129 | |
@@ -138,19 +142,25 @@ discard block |
||
| 138 | 142 | */ |
| 139 | 143 | private function getRenderer(int $target): RendererInterface |
| 140 | 144 | { |
| 141 | - if ($target == self::OUTPUT && System::isCLI()) { |
|
| 142 | - if (System::isColorsSupported(STDOUT)) { |
|
| 145 | + if ($target == self::OUTPUT && System::isCLI()) |
|
| 146 | + { |
|
| 147 | + if (System::isColorsSupported(STDOUT)) |
|
| 148 | + { |
|
| 143 | 149 | $target = self::OUTPUT_CLI_COLORS; |
| 144 | - } else { |
|
| 150 | + } |
|
| 151 | + else |
|
| 152 | + { |
|
| 145 | 153 | $target = self::OUTPUT_CLI; |
| 146 | 154 | } |
| 147 | 155 | } |
| 148 | 156 | |
| 149 | - if (!isset($this->targets[$target])) { |
|
| 157 | + if (!isset($this->targets[$target])) |
|
| 158 | + { |
|
| 150 | 159 | throw new DumperException(sprintf('Undefined dump target %d', $target)); |
| 151 | 160 | } |
| 152 | 161 | |
| 153 | - if (is_string($this->targets[$target])) { |
|
| 162 | + if (is_string($this->targets[$target])) |
|
| 163 | + { |
|
| 154 | 164 | $this->targets[$target] = new $this->targets[$target](); |
| 155 | 165 | } |
| 156 | 166 | |
@@ -175,28 +185,35 @@ discard block |
||
| 175 | 185 | int $level = 0, |
| 176 | 186 | bool $hideHeader = false |
| 177 | 187 | ): string { |
| 178 | - if (!$hideHeader && !empty($name)) { |
|
| 188 | + if (!$hideHeader && !empty($name)) |
|
| 189 | + { |
|
| 179 | 190 | $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '='); |
| 180 | - } else { |
|
| 191 | + } |
|
| 192 | + else |
|
| 193 | + { |
|
| 181 | 194 | $header = $r->indent($level); |
| 182 | 195 | } |
| 183 | 196 | |
| 184 | - if ($level > $this->maxLevel) { |
|
| 197 | + if ($level > $this->maxLevel) |
|
| 198 | + { |
|
| 185 | 199 | //Renderer is not reference based, we can't dump too deep values |
| 186 | 200 | return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n"; |
| 187 | 201 | } |
| 188 | 202 | |
| 189 | 203 | $type = strtolower(gettype($value)); |
| 190 | 204 | |
| 191 | - if ($type == 'array') { |
|
| 205 | + if ($type == 'array') |
|
| 206 | + { |
|
| 192 | 207 | return $header . $this->renderArray($r, $value, $level, $hideHeader); |
| 193 | 208 | } |
| 194 | 209 | |
| 195 | - if ($type == 'object') { |
|
| 210 | + if ($type == 'object') |
|
| 211 | + { |
|
| 196 | 212 | return $header . $this->renderObject($r, $value, $level, $hideHeader); |
| 197 | 213 | } |
| 198 | 214 | |
| 199 | - if ($type == 'resource') { |
|
| 215 | + if ($type == 'resource') |
|
| 216 | + { |
|
| 200 | 217 | //No need to dump resource value |
| 201 | 218 | $element = get_resource_type($value) . ' resource '; |
| 202 | 219 | |
@@ -210,7 +227,8 @@ discard block |
||
| 210 | 227 | $header .= $r->apply("{$type}({$length})", 'type', $type); |
| 211 | 228 | |
| 212 | 229 | $element = null; |
| 213 | - switch ($type) { |
|
| 230 | + switch ($type) |
|
| 231 | + { |
|
| 214 | 232 | case 'string': |
| 215 | 233 | $element = $r->escapeStrings() ? htmlspecialchars($value) : $value; |
| 216 | 234 | break; |
@@ -220,7 +238,8 @@ discard block |
||
| 220 | 238 | break; |
| 221 | 239 | |
| 222 | 240 | default: |
| 223 | - if ($value !== null) { |
|
| 241 | + if ($value !== null) |
|
| 242 | + { |
|
| 224 | 243 | //Not showing null value, type is enough |
| 225 | 244 | $element = var_export($value, true); |
| 226 | 245 | } |
@@ -240,19 +259,25 @@ discard block |
||
| 240 | 259 | */ |
| 241 | 260 | private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string |
| 242 | 261 | { |
| 243 | - if (!$hideHeader) { |
|
| 262 | + if (!$hideHeader) |
|
| 263 | + { |
|
| 244 | 264 | $count = count($array); |
| 245 | 265 | |
| 246 | 266 | //Array size and scope |
| 247 | 267 | $output = $r->apply("array({$count})", 'type', 'array') . "\n"; |
| 248 | 268 | $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n"; |
| 249 | - } else { |
|
| 269 | + } |
|
| 270 | + else |
|
| 271 | + { |
|
| 250 | 272 | $output = ''; |
| 251 | 273 | } |
| 252 | 274 | |
| 253 | - foreach ($array as $key => $value) { |
|
| 254 | - if (!is_numeric($key)) { |
|
| 255 | - if (is_string($key) && $r->escapeStrings()) { |
|
| 275 | + foreach ($array as $key => $value) |
|
| 276 | + { |
|
| 277 | + if (!is_numeric($key)) |
|
| 278 | + { |
|
| 279 | + if (is_string($key) && $r->escapeStrings()) |
|
| 280 | + { |
|
| 256 | 281 | $key = htmlspecialchars($key); |
| 257 | 282 | } |
| 258 | 283 | |
@@ -262,7 +287,8 @@ discard block |
||
| 262 | 287 | $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1); |
| 263 | 288 | } |
| 264 | 289 | |
| 265 | - if (!$hideHeader) { |
|
| 290 | + if (!$hideHeader) |
|
| 291 | + { |
|
| 266 | 292 | //Closing array scope |
| 267 | 293 | $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n"; |
| 268 | 294 | } |
@@ -286,29 +312,38 @@ discard block |
||
| 286 | 312 | bool $hideHeader = false, |
| 287 | 313 | string $class = '' |
| 288 | 314 | ): string { |
| 289 | - if (!$hideHeader) { |
|
| 315 | + if (!$hideHeader) |
|
| 316 | + { |
|
| 290 | 317 | $type = ($class ?: get_class($value)) . ' object '; |
| 291 | 318 | |
| 292 | 319 | $header = $r->apply($type, 'type', 'object') . "\n"; |
| 293 | 320 | $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n"; |
| 294 | - } else { |
|
| 321 | + } |
|
| 322 | + else |
|
| 323 | + { |
|
| 295 | 324 | $header = ''; |
| 296 | 325 | } |
| 297 | 326 | |
| 298 | 327 | //Let's use method specifically created for dumping |
| 299 | - if (method_exists($value, '__debugInfo') || $value instanceof \Closure) { |
|
| 300 | - if ($value instanceof \Closure) { |
|
| 328 | + if (method_exists($value, '__debugInfo') || $value instanceof \Closure) |
|
| 329 | + { |
|
| 330 | + if ($value instanceof \Closure) |
|
| 331 | + { |
|
| 301 | 332 | $debugInfo = $this->describeClosure($value); |
| 302 | - } else { |
|
| 333 | + } |
|
| 334 | + else |
|
| 335 | + { |
|
| 303 | 336 | $debugInfo = $value->__debugInfo(); |
| 304 | 337 | } |
| 305 | 338 | |
| 306 | - if (is_array($debugInfo)) { |
|
| 339 | + if (is_array($debugInfo)) |
|
| 340 | + { |
|
| 307 | 341 | //Pretty view |
| 308 | 342 | $debugInfo = (object)$debugInfo; |
| 309 | 343 | } |
| 310 | 344 | |
| 311 | - if (is_object($debugInfo)) { |
|
| 345 | + if (is_object($debugInfo)) |
|
| 346 | + { |
|
| 312 | 347 | //We are not including syntax elements here |
| 313 | 348 | return $this->renderObject($r, $debugInfo, $level, false, get_class($value)); |
| 314 | 349 | } |
@@ -321,7 +356,8 @@ discard block |
||
| 321 | 356 | $refection = new \ReflectionObject($value); |
| 322 | 357 | |
| 323 | 358 | $output = ''; |
| 324 | - foreach ($refection->getProperties() as $property) { |
|
| 359 | + foreach ($refection->getProperties() as $property) |
|
| 360 | + { |
|
| 325 | 361 | $output .= $this->renderProperty($r, $value, $property, $level); |
| 326 | 362 | } |
| 327 | 363 | |
@@ -339,7 +375,8 @@ discard block |
||
| 339 | 375 | */ |
| 340 | 376 | private function renderProperty(RendererInterface $r, $value, \ReflectionProperty $p, int $level): string |
| 341 | 377 | { |
| 342 | - if ($p->isStatic()) { |
|
| 378 | + if ($p->isStatic()) |
|
| 379 | + { |
|
| 343 | 380 | return ''; |
| 344 | 381 | } |
| 345 | 382 | |
@@ -359,9 +396,12 @@ discard block |
||
| 359 | 396 | //To read private and protected properties |
| 360 | 397 | $p->setAccessible(true); |
| 361 | 398 | |
| 362 | - if ($value instanceof \stdClass) { |
|
| 399 | + if ($value instanceof \stdClass) |
|
| 400 | + { |
|
| 363 | 401 | $name = $r->apply($p->getName(), 'dynamic'); |
| 364 | - } else { |
|
| 402 | + } |
|
| 403 | + else |
|
| 404 | + { |
|
| 365 | 405 | //Property name includes access level |
| 366 | 406 | $name = $p->getName() . $r->apply(':' . $access, 'access', $access); |
| 367 | 407 | } |
@@ -377,9 +417,12 @@ discard block |
||
| 377 | 417 | */ |
| 378 | 418 | private function describeClosure(\Closure $closure): array |
| 379 | 419 | { |
| 380 | - try { |
|
| 420 | + try |
|
| 421 | + { |
|
| 381 | 422 | $r = new \ReflectionFunction($closure); |
| 382 | - } catch (\ReflectionException $e) { |
|
| 423 | + } |
|
| 424 | + catch (\ReflectionException $e) |
|
| 425 | + { |
|
| 383 | 426 | return ['closure' => 'unable to resolve']; |
| 384 | 427 | } |
| 385 | 428 | |
@@ -399,9 +442,12 @@ discard block |
||
| 399 | 442 | */ |
| 400 | 443 | private function getAccess(\ReflectionProperty $p): string |
| 401 | 444 | { |
| 402 | - if ($p->isPrivate()) { |
|
| 445 | + if ($p->isPrivate()) |
|
| 446 | + { |
|
| 403 | 447 | return 'private'; |
| 404 | - } elseif ($p->isProtected()) { |
|
| 448 | + } |
|
| 449 | + elseif ($p->isProtected()) |
|
| 450 | + { |
|
| 405 | 451 | return 'protected'; |
| 406 | 452 | } |
| 407 | 453 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function __construct(LoggerInterface $logger = null) |
| 60 | 60 | { |
| 61 | - if (!empty($logger)) { |
|
| 61 | + if (!empty($logger)){ |
|
| 62 | 62 | $this->setLogger($logger); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $r = $this->getRenderer($target); |
| 87 | 87 | $dump = $r->wrapContent($this->renderValue($r, $value)); |
| 88 | 88 | |
| 89 | - switch ($target) { |
|
| 89 | + switch ($target){ |
|
| 90 | 90 | case self::OUTPUT: |
| 91 | 91 | echo $dump; |
| 92 | 92 | break; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | return $dump; |
| 96 | 96 | |
| 97 | 97 | case self::LOGGER: |
| 98 | - if ($this->logger == null) { |
|
| 98 | + if ($this->logger == null){ |
|
| 99 | 99 | throw new DumperException('Unable to dump value to log, no associated LoggerInterface'); |
| 100 | 100 | } |
| 101 | 101 | $this->logger->debug($dump); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function setRenderer(int $target, RendererInterface $renderer): Dumper |
| 121 | 121 | { |
| 122 | - if (!isset($this->targets[$target])) { |
|
| 122 | + if (!isset($this->targets[$target])){ |
|
| 123 | 123 | throw new DumperException(sprintf('Undefined dump target %d', $target)); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -138,19 +138,19 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | private function getRenderer(int $target): RendererInterface |
| 140 | 140 | { |
| 141 | - if ($target == self::OUTPUT && System::isCLI()) { |
|
| 142 | - if (System::isColorsSupported(STDOUT)) { |
|
| 141 | + if ($target == self::OUTPUT && System::isCLI()){ |
|
| 142 | + if (System::isColorsSupported(STDOUT)){ |
|
| 143 | 143 | $target = self::OUTPUT_CLI_COLORS; |
| 144 | - } else { |
|
| 144 | + }else{ |
|
| 145 | 145 | $target = self::OUTPUT_CLI; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if (!isset($this->targets[$target])) { |
|
| 149 | + if (!isset($this->targets[$target])){ |
|
| 150 | 150 | throw new DumperException(sprintf('Undefined dump target %d', $target)); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (is_string($this->targets[$target])) { |
|
| 153 | + if (is_string($this->targets[$target])){ |
|
| 154 | 154 | $this->targets[$target] = new $this->targets[$target](); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -175,32 +175,32 @@ discard block |
||
| 175 | 175 | int $level = 0, |
| 176 | 176 | bool $hideHeader = false |
| 177 | 177 | ): string { |
| 178 | - if (!$hideHeader && !empty($name)) { |
|
| 179 | - $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '='); |
|
| 180 | - } else { |
|
| 178 | + if (!$hideHeader && !empty($name)){ |
|
| 179 | + $header = $r->indent($level).$r->apply($name, 'name').$r->apply(' = ', 'syntax', '='); |
|
| 180 | + }else{ |
|
| 181 | 181 | $header = $r->indent($level); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ($level > $this->maxLevel) { |
|
| 184 | + if ($level > $this->maxLevel){ |
|
| 185 | 185 | //Renderer is not reference based, we can't dump too deep values |
| 186 | - return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n"; |
|
| 186 | + return $r->indent($level).$r->apply('-too deep-', 'maxLevel')."\n"; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $type = strtolower(gettype($value)); |
| 190 | 190 | |
| 191 | - if ($type == 'array') { |
|
| 192 | - return $header . $this->renderArray($r, $value, $level, $hideHeader); |
|
| 191 | + if ($type == 'array'){ |
|
| 192 | + return $header.$this->renderArray($r, $value, $level, $hideHeader); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ($type == 'object') { |
|
| 196 | - return $header . $this->renderObject($r, $value, $level, $hideHeader); |
|
| 195 | + if ($type == 'object'){ |
|
| 196 | + return $header.$this->renderObject($r, $value, $level, $hideHeader); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ($type == 'resource') { |
|
| 199 | + if ($type == 'resource'){ |
|
| 200 | 200 | //No need to dump resource value |
| 201 | - $element = get_resource_type($value) . ' resource '; |
|
| 201 | + $element = get_resource_type($value).' resource '; |
|
| 202 | 202 | |
| 203 | - return $header . $r->apply($element, 'type', 'resource') . "\n"; |
|
| 203 | + return $header.$r->apply($element, 'type', 'resource')."\n"; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | //Value length |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $header .= $r->apply("{$type}({$length})", 'type', $type); |
| 211 | 211 | |
| 212 | 212 | $element = null; |
| 213 | - switch ($type) { |
|
| 213 | + switch ($type){ |
|
| 214 | 214 | case 'string': |
| 215 | 215 | $element = $r->escapeStrings() ? htmlspecialchars($value) : $value; |
| 216 | 216 | break; |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | break; |
| 221 | 221 | |
| 222 | 222 | default: |
| 223 | - if ($value !== null) { |
|
| 223 | + if ($value !== null){ |
|
| 224 | 224 | //Not showing null value, type is enough |
| 225 | 225 | $element = var_export($value, true); |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | //Including value |
| 230 | - return $header . ' ' . $r->apply($element, 'value', $type) . "\n"; |
|
| 230 | + return $header.' '.$r->apply($element, 'value', $type)."\n"; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -240,19 +240,19 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string |
| 242 | 242 | { |
| 243 | - if (!$hideHeader) { |
|
| 243 | + if (!$hideHeader){ |
|
| 244 | 244 | $count = count($array); |
| 245 | 245 | |
| 246 | 246 | //Array size and scope |
| 247 | - $output = $r->apply("array({$count})", 'type', 'array') . "\n"; |
|
| 248 | - $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n"; |
|
| 249 | - } else { |
|
| 247 | + $output = $r->apply("array({$count})", 'type', 'array')."\n"; |
|
| 248 | + $output .= $r->indent($level).$r->apply('[', 'syntax', '[')."\n"; |
|
| 249 | + }else{ |
|
| 250 | 250 | $output = ''; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - foreach ($array as $key => $value) { |
|
| 254 | - if (!is_numeric($key)) { |
|
| 255 | - if (is_string($key) && $r->escapeStrings()) { |
|
| 253 | + foreach ($array as $key => $value){ |
|
| 254 | + if (!is_numeric($key)){ |
|
| 255 | + if (is_string($key) && $r->escapeStrings()){ |
|
| 256 | 256 | $key = htmlspecialchars($key); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if (!$hideHeader) { |
|
| 265 | + if (!$hideHeader){ |
|
| 266 | 266 | //Closing array scope |
| 267 | - $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n"; |
|
| 267 | + $output .= $r->indent($level).$r->apply(']', 'syntax', ']')."\n"; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | return $output; |
@@ -286,47 +286,47 @@ discard block |
||
| 286 | 286 | bool $hideHeader = false, |
| 287 | 287 | string $class = '' |
| 288 | 288 | ): string { |
| 289 | - if (!$hideHeader) { |
|
| 290 | - $type = ($class ?: get_class($value)) . ' object '; |
|
| 289 | + if (!$hideHeader){ |
|
| 290 | + $type = ($class ?: get_class($value)).' object '; |
|
| 291 | 291 | |
| 292 | - $header = $r->apply($type, 'type', 'object') . "\n"; |
|
| 293 | - $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n"; |
|
| 294 | - } else { |
|
| 292 | + $header = $r->apply($type, 'type', 'object')."\n"; |
|
| 293 | + $header .= $r->indent($level).$r->apply('(', 'syntax', '(')."\n"; |
|
| 294 | + }else{ |
|
| 295 | 295 | $header = ''; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | //Let's use method specifically created for dumping |
| 299 | - if (method_exists($value, '__debugInfo') || $value instanceof \Closure) { |
|
| 300 | - if ($value instanceof \Closure) { |
|
| 299 | + if (method_exists($value, '__debugInfo') || $value instanceof \Closure){ |
|
| 300 | + if ($value instanceof \Closure){ |
|
| 301 | 301 | $debugInfo = $this->describeClosure($value); |
| 302 | - } else { |
|
| 302 | + }else{ |
|
| 303 | 303 | $debugInfo = $value->__debugInfo(); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if (is_array($debugInfo)) { |
|
| 306 | + if (is_array($debugInfo)){ |
|
| 307 | 307 | //Pretty view |
| 308 | 308 | $debugInfo = (object)$debugInfo; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if (is_object($debugInfo)) { |
|
| 311 | + if (is_object($debugInfo)){ |
|
| 312 | 312 | //We are not including syntax elements here |
| 313 | 313 | return $this->renderObject($r, $debugInfo, $level, false, get_class($value)); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | return $header |
| 317 | 317 | . $this->renderValue($r, $debugInfo, '', $level + (is_scalar($value)), true) |
| 318 | - . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n"; |
|
| 318 | + . $r->indent($level).$r->apply(')', 'syntax', ')')."\n"; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $refection = new \ReflectionObject($value); |
| 322 | 322 | |
| 323 | 323 | $output = ''; |
| 324 | - foreach ($refection->getProperties() as $property) { |
|
| 324 | + foreach ($refection->getProperties() as $property){ |
|
| 325 | 325 | $output .= $this->renderProperty($r, $value, $property, $level); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | //Header, content, footer |
| 329 | - return $header . $output . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n"; |
|
| 329 | + return $header.$output.$r->indent($level).$r->apply(')', 'syntax', ')')."\n"; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | private function renderProperty(RendererInterface $r, $value, \ReflectionProperty $p, int $level): string |
| 341 | 341 | { |
| 342 | - if ($p->isStatic()) { |
|
| 342 | + if ($p->isStatic()){ |
|
| 343 | 343 | return ''; |
| 344 | 344 | } |
| 345 | 345 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | !($value instanceof \stdClass) |
| 348 | 348 | && is_string($p->getDocComment()) |
| 349 | 349 | && strpos($p->getDocComment(), '@internal') !== false |
| 350 | - ) { |
|
| 350 | + ){ |
|
| 351 | 351 | // Memory loop while reading doc comment for stdClass variables? |
| 352 | 352 | // Report a PHP bug about treating comment INSIDE property declaration as doc comment. |
| 353 | 353 | return ''; |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | //To read private and protected properties |
| 360 | 360 | $p->setAccessible(true); |
| 361 | 361 | |
| 362 | - if ($value instanceof \stdClass) { |
|
| 362 | + if ($value instanceof \stdClass){ |
|
| 363 | 363 | $name = $r->apply($p->getName(), 'dynamic'); |
| 364 | - } else { |
|
| 364 | + }else{ |
|
| 365 | 365 | //Property name includes access level |
| 366 | - $name = $p->getName() . $r->apply(':' . $access, 'access', $access); |
|
| 366 | + $name = $p->getName().$r->apply(':'.$access, 'access', $access); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | return $this->renderValue($r, $p->getValue($value), $name, $level + 1); |
@@ -377,14 +377,14 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | private function describeClosure(\Closure $closure): array |
| 379 | 379 | { |
| 380 | - try { |
|
| 380 | + try{ |
|
| 381 | 381 | $r = new \ReflectionFunction($closure); |
| 382 | - } catch (\ReflectionException $e) { |
|
| 382 | + }catch (\ReflectionException $e){ |
|
| 383 | 383 | return ['closure' => 'unable to resolve']; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | return [ |
| 387 | - 'name' => $r->getName() . " (lines {$r->getStartLine()}:{$r->getEndLine()})", |
|
| 387 | + 'name' => $r->getName()." (lines {$r->getStartLine()}:{$r->getEndLine()})", |
|
| 388 | 388 | 'file' => $r->getFileName(), |
| 389 | 389 | 'this' => $r->getClosureThis(), |
| 390 | 390 | ]; |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | private function getAccess(\ReflectionProperty $p): string |
| 401 | 401 | { |
| 402 | - if ($p->isPrivate()) { |
|
| 402 | + if ($p->isPrivate()){ |
|
| 403 | 403 | return 'private'; |
| 404 | - } elseif ($p->isProtected()) { |
|
| 404 | + } elseif ($p->isProtected()){ |
|
| 405 | 405 | return 'protected'; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * Directives for dump output forwarding. |
| 31 | 31 | */ |
| 32 | 32 | public const OUTPUT = 0; |
| 33 | - public const RETURN = 1; |
|
| 33 | + public const return = 1; |
|
| 34 | 34 | public const LOGGER = 2; |
| 35 | 35 | public const ERROR_LOG = 3; |
| 36 | 36 | public const OUTPUT_CLI = 4; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | self::OUTPUT => HtmlRenderer::class, |
| 50 | 50 | self::OUTPUT_CLI => PlainRenderer::class, |
| 51 | 51 | self::OUTPUT_CLI_COLORS => ConsoleRenderer::class, |
| 52 | - self::RETURN => HtmlRenderer::class, |
|
| 52 | + self::return => HtmlRenderer::class, |
|
| 53 | 53 | self::LOGGER => PlainRenderer::class, |
| 54 | 54 | self::ERROR_LOG => PlainRenderer::class, |
| 55 | 55 | self::ROADRUNNER => PlainRenderer::class, |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | break; |
| 95 | 95 | |
| 96 | 96 | case self::ROADRUNNER: |
| 97 | - case self::RETURN: |
|
| 97 | + case self::return: |
|
| 98 | 98 | return $dump; |
| 99 | 99 | |
| 100 | 100 | case self::LOGGER: |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @var string |
| 25 | 25 | */ |
| 26 | - protected $element = '%s%s' . Color::RESET; |
|
| 26 | + protected $element = '%s%s'.Color::RESET; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Set of styles associated with different dumping properties. |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function apply($element, string $type, string $context = ''): string |
| 64 | 64 | { |
| 65 | - if (!empty($style = $this->getStyle($type, $context))) { |
|
| 65 | + if (!empty($style = $this->getStyle($type, $context))){ |
|
| 66 | 66 | return sprintf($this->element, $style, $element); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | private function getStyle(string $type, string $context): string |
| 89 | 89 | { |
| 90 | - if (isset($this->styles[$type][$context])) { |
|
| 90 | + if (isset($this->styles[$type][$context])){ |
|
| 91 | 91 | return $this->styles[$type][$context]; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (isset($this->styles[$type]['common'])) { |
|
| 94 | + if (isset($this->styles[$type]['common'])){ |
|
| 95 | 95 | return $this->styles[$type]['common']; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (isset($this->styles[$type]) && is_string($this->styles[$type])) { |
|
| 98 | + if (isset($this->styles[$type]) && is_string($this->styles[$type])){ |
|
| 99 | 99 | return $this->styles[$type]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -62,7 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function apply($element, string $type, string $context = ''): string |
| 64 | 64 | { |
| 65 | - if (!empty($style = $this->getStyle($type, $context))) { |
|
| 65 | + if (!empty($style = $this->getStyle($type, $context))) |
|
| 66 | + { |
|
| 66 | 67 | return sprintf($this->element, $style, $element); |
| 67 | 68 | } |
| 68 | 69 | |
@@ -87,15 +88,18 @@ discard block |
||
| 87 | 88 | */ |
| 88 | 89 | private function getStyle(string $type, string $context): string |
| 89 | 90 | { |
| 90 | - if (isset($this->styles[$type][$context])) { |
|
| 91 | + if (isset($this->styles[$type][$context])) |
|
| 92 | + { |
|
| 91 | 93 | return $this->styles[$type][$context]; |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | - if (isset($this->styles[$type]['common'])) { |
|
| 96 | + if (isset($this->styles[$type]['common'])) |
|
| 97 | + { |
|
| 95 | 98 | return $this->styles[$type]['common']; |
| 96 | 99 | } |
| 97 | 100 | |
| 98 | - if (isset($this->styles[$type]) && is_string($this->styles[$type])) { |
|
| 101 | + if (isset($this->styles[$type]) && is_string($this->styles[$type])) |
|
| 102 | + { |
|
| 99 | 103 | return $this->styles[$type]; |
| 100 | 104 | } |
| 101 | 105 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function indent(int $level): string |
| 44 | 44 | { |
| 45 | - if ($level == 0) { |
|
| 45 | + if ($level == 0){ |
|
| 46 | 46 | return ''; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -42,7 +42,8 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function indent(int $level): string |
| 44 | 44 | { |
| 45 | - if ($level == 0) { |
|
| 45 | + if ($level == 0) |
|
| 46 | + { |
|
| 46 | 47 | return ''; |
| 47 | 48 | } |
| 48 | 49 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * Default coloring schema. |
| 23 | 23 | */ |
| 24 | - public const DEFAULT = [ |
|
| 24 | + public const default = [ |
|
| 25 | 25 | 'body' => '<pre style="background-color: white; font-family: monospace;">%s</pre>', |
| 26 | 26 | 'element' => '<span style="%s;">%s</span>', |
| 27 | 27 | 'indent' => '· ', |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @var array |
| 103 | 103 | */ |
| 104 | - protected $style = self::DEFAULT; |
|
| 104 | + protected $style = self::default; |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * @param array $style |
| 108 | 108 | */ |
| 109 | - public function __construct(array $style = self::DEFAULT) |
|
| 109 | + public function __construct(array $style = self::default) |
|
| 110 | 110 | { |
| 111 | 111 | $this->style = $style; |
| 112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function apply($element, string $type, string $context = ''): string |
| 118 | 118 | { |
| 119 | - if (!empty($style = $this->getStyle($type, $context))) { |
|
| 119 | + if (!empty($style = $this->getStyle($type, $context))){ |
|
| 120 | 120 | return sprintf($this->style['element'], $style, $element); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function indent(int $level): string |
| 138 | 138 | { |
| 139 | - if ($level == 0) { |
|
| 139 | + if ($level == 0){ |
|
| 140 | 140 | return ''; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | private function getStyle(string $type, string $context): string |
| 163 | 163 | { |
| 164 | - if (isset($this->style[$type][$context])) { |
|
| 164 | + if (isset($this->style[$type][$context])){ |
|
| 165 | 165 | return $this->style[$type][$context]; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if (isset($this->style[$type]['common'])) { |
|
| 168 | + if (isset($this->style[$type]['common'])){ |
|
| 169 | 169 | return $this->style[$type]['common']; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if (isset($this->style[$type]) && is_string($this->style[$type])) { |
|
| 172 | + if (isset($this->style[$type]) && is_string($this->style[$type])){ |
|
| 173 | 173 | return $this->style[$type]; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -116,7 +116,8 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function apply($element, string $type, string $context = ''): string |
| 118 | 118 | { |
| 119 | - if (!empty($style = $this->getStyle($type, $context))) { |
|
| 119 | + if (!empty($style = $this->getStyle($type, $context))) |
|
| 120 | + { |
|
| 120 | 121 | return sprintf($this->style['element'], $style, $element); |
| 121 | 122 | } |
| 122 | 123 | |
@@ -136,7 +137,8 @@ discard block |
||
| 136 | 137 | */ |
| 137 | 138 | public function indent(int $level): string |
| 138 | 139 | { |
| 139 | - if ($level == 0) { |
|
| 140 | + if ($level == 0) |
|
| 141 | + { |
|
| 140 | 142 | return ''; |
| 141 | 143 | } |
| 142 | 144 | |
@@ -161,15 +163,18 @@ discard block |
||
| 161 | 163 | */ |
| 162 | 164 | private function getStyle(string $type, string $context): string |
| 163 | 165 | { |
| 164 | - if (isset($this->style[$type][$context])) { |
|
| 166 | + if (isset($this->style[$type][$context])) |
|
| 167 | + { |
|
| 165 | 168 | return $this->style[$type][$context]; |
| 166 | 169 | } |
| 167 | 170 | |
| 168 | - if (isset($this->style[$type]['common'])) { |
|
| 171 | + if (isset($this->style[$type]['common'])) |
|
| 172 | + { |
|
| 169 | 173 | return $this->style[$type]['common']; |
| 170 | 174 | } |
| 171 | 175 | |
| 172 | - if (isset($this->style[$type]) && is_string($this->style[$type])) { |
|
| 176 | + if (isset($this->style[$type]) && is_string($this->style[$type])) |
|
| 177 | + { |
|
| 173 | 178 | return $this->style[$type]; |
| 174 | 179 | } |
| 175 | 180 | |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $context |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
| 58 | + foreach ($this->listenedRegistry->getListeners() as $listener){ |
|
| 59 | 59 | call_user_func($listener, $e); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -55,7 +55,8 @@ |
||
| 55 | 55 | $context |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
| 58 | + foreach ($this->listenedRegistry->getListeners() as $listener) |
|
| 59 | + { |
|
| 59 | 60 | call_user_func($listener, $e); |
| 60 | 61 | } |
| 61 | 62 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function addListener(callable $listener): void |
| 26 | 26 | { |
| 27 | - if (!array_search($listener, $this->listeners, true)) { |
|
| 27 | + if (!array_search($listener, $this->listeners, true)){ |
|
| 28 | 28 | $this->listeners[] = $listener; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function removeListener(callable $listener): void |
| 36 | 36 | { |
| 37 | 37 | $key = array_search($listener, $this->listeners, true); |
| 38 | - if ($key !== null) { |
|
| 38 | + if ($key !== null){ |
|
| 39 | 39 | unset($this->listeners[$key]); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -24,7 +24,8 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function addListener(callable $listener): void |
| 26 | 26 | { |
| 27 | - if (!array_search($listener, $this->listeners, true)) { |
|
| 27 | + if (!array_search($listener, $this->listeners, true)) |
|
| 28 | + { |
|
| 28 | 29 | $this->listeners[] = $listener; |
| 29 | 30 | } |
| 30 | 31 | } |
@@ -35,7 +36,8 @@ discard block |
||
| 35 | 36 | public function removeListener(callable $listener): void |
| 36 | 37 | { |
| 37 | 38 | $key = array_search($listener, $this->listeners, true); |
| 38 | - if ($key !== null) { |
|
| 39 | + if ($key !== null) |
|
| 40 | + { |
|
| 39 | 41 | unset($this->listeners[$key]); |
| 40 | 42 | } |
| 41 | 43 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | string $level, |
| 42 | 42 | string $message, |
| 43 | 43 | array $context = [] |
| 44 | - ) { |
|
| 44 | + ){ |
|
| 45 | 45 | $this->time = $time; |
| 46 | 46 | $this->channel = $channel; |
| 47 | 47 | $this->level = $level; |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | protected function getLogger(string $channel = null): LoggerInterface |
| 44 | 44 | { |
| 45 | - if ($channel !== null) { |
|
| 45 | + if ($channel !== null){ |
|
| 46 | 46 | return $this->allocateLogger($channel); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ($this->logger !== null) { |
|
| 49 | + if ($this->logger !== null){ |
|
| 50 | 50 | return $this->logger; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | private function allocateLogger(string $channel): LoggerInterface |
| 64 | 64 | { |
| 65 | 65 | $container = ContainerScope::getContainer(); |
| 66 | - if (empty($container) || !$container->has(LogsInterface::class)) { |
|
| 66 | + if (empty($container) || !$container->has(LogsInterface::class)){ |
|
| 67 | 67 | return $this->logger ?? new NullLogger(); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -42,11 +42,13 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | protected function getLogger(string $channel = null): LoggerInterface |
| 44 | 44 | { |
| 45 | - if ($channel !== null) { |
|
| 45 | + if ($channel !== null) |
|
| 46 | + { |
|
| 46 | 47 | return $this->allocateLogger($channel); |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | - if ($this->logger !== null) { |
|
| 50 | + if ($this->logger !== null) |
|
| 51 | + { |
|
| 50 | 52 | return $this->logger; |
| 51 | 53 | } |
| 52 | 54 | |
@@ -63,7 +65,8 @@ discard block |
||
| 63 | 65 | private function allocateLogger(string $channel): LoggerInterface |
| 64 | 66 | { |
| 65 | 67 | $container = ContainerScope::getContainer(); |
| 66 | - if (empty($container) || !$container->has(LogsInterface::class)) { |
|
| 68 | + if (empty($container) || !$container->has(LogsInterface::class)) |
|
| 69 | + { |
|
| 67 | 70 | return $this->logger ?? new NullLogger(); |
| 68 | 71 | } |
| 69 | 72 | |