@@ -50,10 +50,12 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @var SplFileInfo |
| 52 | 52 | */ |
| 53 | - foreach ($this->finder->getIterator() as $file) { |
|
| 53 | + foreach ($this->finder->getIterator() as $file) |
|
| 54 | + { |
|
| 54 | 55 | $reflection = new ReflectionFile((string)$file); |
| 55 | 56 | |
| 56 | - if ($reflection->hasIncludes()) { |
|
| 57 | + if ($reflection->hasIncludes()) |
|
| 58 | + { |
|
| 57 | 59 | //We are not analyzing files which has includes, it's not safe to require such reflections |
| 58 | 60 | $this->getLogger()->warning( |
| 59 | 61 | sprintf('File `%s` has includes and excluded from analysis', $file), |
@@ -80,8 +82,10 @@ discard block |
||
| 80 | 82 | */ |
| 81 | 83 | protected function classReflection(string $class): \ReflectionClass |
| 82 | 84 | { |
| 83 | - $loader = function ($class) { |
|
| 84 | - if ($class == LocatorException::class) { |
|
| 85 | + $loader = function ($class) |
|
| 86 | + { |
|
| 87 | + if ($class == LocatorException::class) |
|
| 88 | + { |
|
| 85 | 89 | return; |
| 86 | 90 | } |
| 87 | 91 | |
@@ -91,12 +95,16 @@ discard block |
||
| 91 | 95 | //To suspend class dependency exception |
| 92 | 96 | spl_autoload_register($loader); |
| 93 | 97 | |
| 94 | - try { |
|
| 98 | + try |
|
| 99 | + { |
|
| 95 | 100 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, |
| 96 | 101 | //we are going to handle such exception and convert it soft exception |
| 97 | 102 | return new \ReflectionClass($class); |
| 98 | - } catch (\Throwable $e) { |
|
| 99 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
| 103 | + } |
|
| 104 | + catch (\Throwable $e) |
|
| 105 | + { |
|
| 106 | + if ($e instanceof LocatorException && $e->getPrevious() != null) |
|
| 107 | + { |
|
| 100 | 108 | $e = $e->getPrevious(); |
| 101 | 109 | } |
| 102 | 110 | |
@@ -112,7 +120,9 @@ discard block |
||
| 112 | 120 | ); |
| 113 | 121 | |
| 114 | 122 | throw new LocatorException($e->getMessage(), $e->getCode(), $e); |
| 115 | - } finally { |
|
| 123 | + } |
|
| 124 | + finally |
|
| 125 | + { |
|
| 116 | 126 | spl_autoload_unregister($loader); |
| 117 | 127 | } |
| 118 | 128 | } |
@@ -128,13 +138,15 @@ discard block |
||
| 128 | 138 | { |
| 129 | 139 | $traits = []; |
| 130 | 140 | |
| 131 | - while ($class) { |
|
| 141 | + while ($class) |
|
| 142 | + { |
|
| 132 | 143 | $traits = array_merge(class_uses($class), $traits); |
| 133 | 144 | $class = get_parent_class($class); |
| 134 | 145 | } |
| 135 | 146 | |
| 136 | 147 | //Traits from traits |
| 137 | - foreach (array_flip($traits) as $trait) { |
|
| 148 | + foreach (array_flip($traits) as $trait) |
|
| 149 | + { |
|
| 138 | 150 | $traits = array_merge(class_uses($trait), $traits); |
| 139 | 151 | } |
| 140 | 152 | |
@@ -44,15 +44,18 @@ discard block |
||
| 44 | 44 | 'namespaces' => $config->getNamespaces(), |
| 45 | 45 | ]); |
| 46 | 46 | |
| 47 | - foreach ($this->config->getDependencies() as $dependency) { |
|
| 47 | + foreach ($this->config->getDependencies() as $dependency) |
|
| 48 | + { |
|
| 48 | 49 | $this->addDependency($dependency->resolve($factory)); |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | - foreach ($this->config->getEngines() as $engine) { |
|
| 52 | + foreach ($this->config->getEngines() as $engine) |
|
| 53 | + { |
|
| 52 | 54 | $this->addEngine($engine->resolve($factory)); |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | - if ($this->config->isCacheEnabled()) { |
|
| 57 | + if ($this->config->isCacheEnabled()) |
|
| 58 | + { |
|
| 56 | 59 | $this->cache = new ViewCache(); |
| 57 | 60 | } |
| 58 | 61 | } |
@@ -84,7 +87,8 @@ discard block |
||
| 84 | 87 | { |
| 85 | 88 | $this->engines[] = $engine->withLoader($this->loader); |
| 86 | 89 | |
| 87 | - uasort($this->engines, function (EngineInterface $a, EngineInterface $b) { |
|
| 90 | + uasort($this->engines, function (EngineInterface $a, EngineInterface $b) |
|
| 91 | + { |
|
| 88 | 92 | return strcmp($a->getLoader()->getExtension(), $b->getLoader()->getExtension()); |
| 89 | 93 | }); |
| 90 | 94 | |
@@ -110,7 +114,8 @@ discard block |
||
| 110 | 114 | */ |
| 111 | 115 | public function compile(string $path): void |
| 112 | 116 | { |
| 113 | - if ($this->cache !== null) { |
|
| 117 | + if ($this->cache !== null) |
|
| 118 | + { |
|
| 114 | 119 | $this->cache->resetPath($path); |
| 115 | 120 | } |
| 116 | 121 | |
@@ -118,7 +123,8 @@ discard block |
||
| 118 | 123 | |
| 119 | 124 | // Rotate all possible context variants and warm up cache |
| 120 | 125 | $generator = new ContextGenerator($this->context); |
| 121 | - foreach ($generator->generate() as $context) { |
|
| 126 | + foreach ($generator->generate() as $context) |
|
| 127 | + { |
|
| 122 | 128 | $engine->reset($path, $context); |
| 123 | 129 | $engine->compile($path, $context); |
| 124 | 130 | } |
@@ -131,7 +137,8 @@ discard block |
||
| 131 | 137 | */ |
| 132 | 138 | public function reset(string $path): void |
| 133 | 139 | { |
| 134 | - if ($this->cache !== null) { |
|
| 140 | + if ($this->cache !== null) |
|
| 141 | + { |
|
| 135 | 142 | $this->cache->resetPath($path); |
| 136 | 143 | } |
| 137 | 144 | |
@@ -139,7 +146,8 @@ discard block |
||
| 139 | 146 | |
| 140 | 147 | // Rotate all possible context variants and warm up cache |
| 141 | 148 | $generator = new ContextGenerator($this->context); |
| 142 | - foreach ($generator->generate() as $context) { |
|
| 149 | + foreach ($generator->generate() as $context) |
|
| 150 | + { |
|
| 143 | 151 | $engine->reset($path, $context); |
| 144 | 152 | } |
| 145 | 153 | } |
@@ -154,13 +162,15 @@ discard block |
||
| 154 | 162 | */ |
| 155 | 163 | public function get(string $path): ViewInterface |
| 156 | 164 | { |
| 157 | - if ($this->cache !== null && $this->cache->has($this->context, $path)) { |
|
| 165 | + if ($this->cache !== null && $this->cache->has($this->context, $path)) |
|
| 166 | + { |
|
| 158 | 167 | return $this->cache->get($this->context, $path); |
| 159 | 168 | } |
| 160 | 169 | |
| 161 | 170 | $view = $this->findEngine($path)->get($path, $this->context); |
| 162 | 171 | |
| 163 | - if ($this->cache !== null) { |
|
| 172 | + if ($this->cache !== null) |
|
| 173 | + { |
|
| 164 | 174 | $this->cache->set($this->context, $path, $view); |
| 165 | 175 | } |
| 166 | 176 | |
@@ -187,8 +197,10 @@ discard block |
||
| 187 | 197 | */ |
| 188 | 198 | protected function findEngine(string $path): EngineInterface |
| 189 | 199 | { |
| 190 | - foreach ($this->engines as $engine) { |
|
| 191 | - if ($engine->getLoader()->exists($path)) { |
|
| 200 | + foreach ($this->engines as $engine) |
|
| 201 | + { |
|
| 202 | + if ($engine->getLoader()->exists($path)) |
|
| 203 | + { |
|
| 192 | 204 | return $engine; |
| 193 | 205 | } |
| 194 | 206 | } |
@@ -34,13 +34,17 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function perform(DatabaseConfig $config, DatabaseManager $dbal): void |
| 36 | 36 | { |
| 37 | - if ($this->argument('db')) { |
|
| 37 | + if ($this->argument('db')) |
|
| 38 | + { |
|
| 38 | 39 | $databases = [$this->argument('db')]; |
| 39 | - } else { |
|
| 40 | + } |
|
| 41 | + else |
|
| 42 | + { |
|
| 40 | 43 | $databases = array_keys($config->getDatabases()); |
| 41 | 44 | } |
| 42 | 45 | |
| 43 | - if (empty($databases)) { |
|
| 46 | + if (empty($databases)) |
|
| 47 | + { |
|
| 44 | 48 | $this->writeln('<fg=red>No databases found.</fg=red>'); |
| 45 | 49 | |
| 46 | 50 | return; |
@@ -58,7 +62,8 @@ discard block |
||
| 58 | 62 | ] |
| 59 | 63 | ); |
| 60 | 64 | |
| 61 | - foreach ($databases as $database) { |
|
| 65 | + foreach ($databases as $database) |
|
| 66 | + { |
|
| 62 | 67 | $database = $dbal->database($database); |
| 63 | 68 | |
| 64 | 69 | /** @var Driver $driver */ |
@@ -71,12 +76,16 @@ discard block |
||
| 71 | 76 | $database->getPrefix() ?: '<comment>---</comment>', |
| 72 | 77 | ]; |
| 73 | 78 | |
| 74 | - try { |
|
| 79 | + try |
|
| 80 | + { |
|
| 75 | 81 | $driver->connect(); |
| 76 | - } catch (\Exception $exception) { |
|
| 82 | + } |
|
| 83 | + catch (\Exception $exception) |
|
| 84 | + { |
|
| 77 | 85 | $this->renderException($grid, $header, $exception); |
| 78 | 86 | |
| 79 | - if ($database->getName() != end($databases)) { |
|
| 87 | + if ($database->getName() != end($databases)) |
|
| 88 | + { |
|
| 80 | 89 | $grid->addRow(new TableSeparator()); |
| 81 | 90 | } |
| 82 | 91 | |
@@ -85,7 +94,8 @@ discard block |
||
| 85 | 94 | |
| 86 | 95 | $header[] = '<info>connected</info>'; |
| 87 | 96 | $this->renderTables($grid, $header, $database); |
| 88 | - if ($database->getName() != end($databases)) { |
|
| 97 | + if ($database->getName() != end($databases)) |
|
| 98 | + { |
|
| 89 | 99 | $grid->addRow(new TableSeparator()); |
| 90 | 100 | } |
| 91 | 101 | } |
@@ -119,7 +129,8 @@ discard block |
||
| 119 | 129 | */ |
| 120 | 130 | private function renderTables(Table $grid, array $header, Database $database): void |
| 121 | 131 | { |
| 122 | - foreach ($database->getTables() as $table) { |
|
| 132 | + foreach ($database->getTables() as $table) |
|
| 133 | + { |
|
| 123 | 134 | $grid->addRow( |
| 124 | 135 | array_merge( |
| 125 | 136 | $header, |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $permission = $this->getPermissions($controller, $action); |
| 54 | 54 | |
| 55 | - if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) { |
|
| 55 | + if ($permission !== null && !$this->guard->allows($permission[0], $parameters)) |
|
| 56 | + { |
|
| 56 | 57 | throw new ControllerException($permission[2], $permission[1]); |
| 57 | 58 | } |
| 58 | 59 | |
@@ -70,14 +71,18 @@ discard block |
||
| 70 | 71 | private function getPermissions(string $controller, string $action): ?array |
| 71 | 72 | { |
| 72 | 73 | $key = sprintf('%s:%s', $controller, $action); |
| 73 | - if (array_key_exists($key, $this->cache)) { |
|
| 74 | + if (array_key_exists($key, $this->cache)) |
|
| 75 | + { |
|
| 74 | 76 | return $this->cache[$key]; |
| 75 | 77 | } |
| 76 | 78 | |
| 77 | 79 | $this->cache[$key] = null; |
| 78 | - try { |
|
| 80 | + try |
|
| 81 | + { |
|
| 79 | 82 | $method = new \ReflectionMethod($controller, $action); |
| 80 | - } catch (\ReflectionException $e) { |
|
| 83 | + } |
|
| 84 | + catch (\ReflectionException $e) |
|
| 85 | + { |
|
| 81 | 86 | return null; |
| 82 | 87 | } |
| 83 | 88 | |
@@ -95,7 +100,8 @@ discard block |
||
| 95 | 100 | Guarded::class |
| 96 | 101 | ); |
| 97 | 102 | |
| 98 | - if ($action === null) { |
|
| 103 | + if ($action === null) |
|
| 104 | + { |
|
| 99 | 105 | return null; |
| 100 | 106 | } |
| 101 | 107 | |
@@ -118,7 +124,8 @@ discard block |
||
| 118 | 124 | $guarded->errorMessage ?? sprintf('Unauthorized access `%s`', $guarded->permission ?? $method->getName()), |
| 119 | 125 | ]; |
| 120 | 126 | |
| 121 | - if ($guarded->permission === null && $ns === null) { |
|
| 127 | + if ($guarded->permission === null && $ns === null) |
|
| 128 | + { |
|
| 122 | 129 | throw new InterceptorException( |
| 123 | 130 | sprintf( |
| 124 | 131 | 'Unable to apply @Guarded without name or @GuardNamespace on `%s`->`%s`', |
@@ -128,16 +135,19 @@ discard block |
||
| 128 | 135 | ); |
| 129 | 136 | } |
| 130 | 137 | |
| 131 | - if ($ns !== null) { |
|
| 138 | + if ($ns !== null) |
|
| 139 | + { |
|
| 132 | 140 | $permission[0] = sprintf('%s.%s', $ns->namespace, $permission[0]); |
| 133 | 141 | } |
| 134 | 142 | |
| 135 | - if ($this->namespace !== null) { |
|
| 143 | + if ($this->namespace !== null) |
|
| 144 | + { |
|
| 136 | 145 | // global namespace |
| 137 | 146 | $permission[0] = sprintf('%s.%s', $this->namespace, $permission[0]); |
| 138 | 147 | } |
| 139 | 148 | |
| 140 | - switch ($guarded->else) { |
|
| 149 | + switch ($guarded->else) |
|
| 150 | + { |
|
| 141 | 151 | case 'unauthorized': |
| 142 | 152 | $permission[1] = ControllerException::UNAUTHORIZED; |
| 143 | 153 | break; |
@@ -67,13 +67,16 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 69 | 69 | { |
| 70 | - if ($request->getUri()->getPath() !== $this->config->getPath()) { |
|
| 70 | + if ($request->getUri()->getPath() !== $this->config->getPath()) |
|
| 71 | + { |
|
| 71 | 72 | return $handler->handle($request); |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | // server authorization |
| 75 | - if ($request->getAttribute('ws:joinServer', null) !== null) { |
|
| 76 | - if (!$this->authorizeServer($request)) { |
|
| 76 | + if ($request->getAttribute('ws:joinServer', null) !== null) |
|
| 77 | + { |
|
| 78 | + if (!$this->authorizeServer($request)) |
|
| 79 | + { |
|
| 77 | 80 | return $this->responseFactory->createResponse(403); |
| 78 | 81 | } |
| 79 | 82 | |
@@ -81,10 +84,13 @@ discard block |
||
| 81 | 84 | } |
| 82 | 85 | |
| 83 | 86 | // topic authorization |
| 84 | - if (is_string($request->getAttribute('ws:joinTopics', null))) { |
|
| 87 | + if (is_string($request->getAttribute('ws:joinTopics', null))) |
|
| 88 | + { |
|
| 85 | 89 | $topics = explode(',', $request->getAttribute('ws:joinTopics')); |
| 86 | - foreach ($topics as $topic) { |
|
| 87 | - if (!$this->authorizeTopic($request, $topic)) { |
|
| 90 | + foreach ($topics as $topic) |
|
| 91 | + { |
|
| 92 | + if (!$this->authorizeTopic($request, $topic)) |
|
| 93 | + { |
|
| 88 | 94 | return $this->responseFactory->createResponse(403); |
| 89 | 95 | } |
| 90 | 96 | } |
@@ -104,7 +110,8 @@ discard block |
||
| 104 | 110 | private function authorizeServer(ServerRequestInterface $request): bool |
| 105 | 111 | { |
| 106 | 112 | $callback = $this->config->getServerCallback(); |
| 107 | - if ($callback === null) { |
|
| 113 | + if ($callback === null) |
|
| 114 | + { |
|
| 108 | 115 | return true; |
| 109 | 116 | } |
| 110 | 117 | |
@@ -122,7 +129,8 @@ discard block |
||
| 122 | 129 | { |
| 123 | 130 | $parameters = []; |
| 124 | 131 | $callback = $this->config->findTopicCallback($topic, $parameters); |
| 125 | - if ($callback === null) { |
|
| 132 | + if ($callback === null) |
|
| 133 | + { |
|
| 126 | 134 | return false; |
| 127 | 135 | } |
| 128 | 136 | |
@@ -141,7 +149,8 @@ discard block |
||
| 141 | 149 | { |
| 142 | 150 | /** @var \ReflectionFunctionAbstract $reflection */ |
| 143 | 151 | $reflection = null; |
| 144 | - switch (true) { |
|
| 152 | + switch (true) |
|
| 153 | + { |
|
| 145 | 154 | case $callback instanceof \Closure || is_string($callback): |
| 146 | 155 | $reflection = new \ReflectionFunction($callback); |
| 147 | 156 | break; |
@@ -159,7 +168,8 @@ discard block |
||
| 159 | 168 | [ |
| 160 | 169 | ServerRequestInterface::class => $request, |
| 161 | 170 | ], |
| 162 | - function () use ($reflection, $parameters, $callback) { |
|
| 171 | + function () use ($reflection, $parameters, $callback) |
|
| 172 | + { |
|
| 163 | 173 | return call_user_func_array( |
| 164 | 174 | $callback, |
| 165 | 175 | $this->resolver->resolveArguments($reflection, $parameters) |
@@ -72,7 +72,8 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function stream_open($path, $mode, $options, &$opened_path) |
| 74 | 74 | { |
| 75 | - if (!isset(self::$uris[$path])) { |
|
| 75 | + if (!isset(self::$uris[$path])) |
|
| 76 | + { |
|
| 76 | 77 | return false; |
| 77 | 78 | } |
| 78 | 79 | |
@@ -156,7 +157,8 @@ discard block |
||
| 156 | 157 | */ |
| 157 | 158 | public function url_stat($path, $flags) |
| 158 | 159 | { |
| 159 | - if (!isset(self::$uris[$path])) { |
|
| 160 | + if (!isset(self::$uris[$path])) |
|
| 161 | + { |
|
| 160 | 162 | return null; |
| 161 | 163 | } |
| 162 | 164 | |
@@ -168,7 +170,8 @@ discard block |
||
| 168 | 170 | */ |
| 169 | 171 | public static function register() |
| 170 | 172 | { |
| 171 | - if (self::$registered) { |
|
| 173 | + if (self::$registered) |
|
| 174 | + { |
|
| 172 | 175 | return; |
| 173 | 176 | } |
| 174 | 177 | |
@@ -184,7 +187,8 @@ discard block |
||
| 184 | 187 | */ |
| 185 | 188 | public static function has($file) |
| 186 | 189 | { |
| 187 | - if ($file instanceof StreamInterface) { |
|
| 190 | + if ($file instanceof StreamInterface) |
|
| 191 | + { |
|
| 188 | 192 | $file = 'spiral://' . spl_object_hash($file); |
| 189 | 193 | } |
| 190 | 194 | |
@@ -202,15 +206,18 @@ discard block |
||
| 202 | 206 | public static function getResource(StreamInterface $stream) |
| 203 | 207 | { |
| 204 | 208 | $mode = null; |
| 205 | - if ($stream->isReadable()) { |
|
| 209 | + if ($stream->isReadable()) |
|
| 210 | + { |
|
| 206 | 211 | $mode = 'r'; |
| 207 | 212 | } |
| 208 | 213 | |
| 209 | - if ($stream->isWritable()) { |
|
| 214 | + if ($stream->isWritable()) |
|
| 215 | + { |
|
| 210 | 216 | $mode = !empty($mode) ? 'r+' : 'w'; |
| 211 | 217 | } |
| 212 | 218 | |
| 213 | - if (empty($mode)) { |
|
| 219 | + if (empty($mode)) |
|
| 220 | + { |
|
| 214 | 221 | throw new WrapperException('Stream is not available in read or write modes'); |
| 215 | 222 | } |
| 216 | 223 | |
@@ -241,7 +248,8 @@ discard block |
||
| 241 | 248 | */ |
| 242 | 249 | public static function release($file) |
| 243 | 250 | { |
| 244 | - if ($file instanceof StreamInterface) { |
|
| 251 | + if ($file instanceof StreamInterface) |
|
| 252 | + { |
|
| 245 | 253 | $file = 'spiral://' . spl_object_hash($file); |
| 246 | 254 | } |
| 247 | 255 | |
@@ -257,12 +265,15 @@ discard block |
||
| 257 | 265 | private function getStreamStats(StreamInterface $stream) |
| 258 | 266 | { |
| 259 | 267 | $mode = $this->mode; |
| 260 | - if (empty($mode)) { |
|
| 261 | - if ($stream->isReadable()) { |
|
| 268 | + if (empty($mode)) |
|
| 269 | + { |
|
| 270 | + if ($stream->isReadable()) |
|
| 271 | + { |
|
| 262 | 272 | $mode = 'r'; |
| 263 | 273 | } |
| 264 | 274 | |
| 265 | - if ($stream->isWritable()) { |
|
| 275 | + if ($stream->isWritable()) |
|
| 276 | + { |
|
| 266 | 277 | $mode = !empty($mode) ? 'r+' : 'w'; |
| 267 | 278 | } |
| 268 | 279 | } |
@@ -39,24 +39,29 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | private function renderTrace(array $trace, int $verbosity): \Generator |
| 41 | 41 | { |
| 42 | - foreach ($trace as $item) { |
|
| 42 | + foreach ($trace as $item) |
|
| 43 | + { |
|
| 43 | 44 | $result = []; |
| 44 | 45 | |
| 45 | - if (isset($item['class'])) { |
|
| 46 | + if (isset($item['class'])) |
|
| 47 | + { |
|
| 46 | 48 | $result['function'] = sprintf( |
| 47 | 49 | '%s%s%s()', |
| 48 | 50 | $item['class'], |
| 49 | 51 | $item['type'], |
| 50 | 52 | $item['function'] |
| 51 | 53 | ); |
| 52 | - } else { |
|
| 54 | + } |
|
| 55 | + else |
|
| 56 | + { |
|
| 53 | 57 | $result['function'] = sprintf( |
| 54 | 58 | '%s()', |
| 55 | 59 | $item['function'] |
| 56 | 60 | ); |
| 57 | 61 | } |
| 58 | 62 | |
| 59 | - if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) { |
|
| 63 | + if ($verbosity >= self::VERBOSITY_VERBOSE && isset($item['file'])) |
|
| 64 | + { |
|
| 60 | 65 | $result['at'] = [ |
| 61 | 66 | 'file' => $item['file'] ?? null, |
| 62 | 67 | 'line' => $item['line'] ?? null, |
@@ -33,7 +33,8 @@ discard block |
||
| 33 | 33 | protected function getStacktrace(\Throwable $e): array |
| 34 | 34 | { |
| 35 | 35 | $stacktrace = $e->getTrace(); |
| 36 | - if (empty($stacktrace)) { |
|
| 36 | + if (empty($stacktrace)) |
|
| 37 | + { |
|
| 37 | 38 | return []; |
| 38 | 39 | } |
| 39 | 40 | |
@@ -43,7 +44,8 @@ discard block |
||
| 43 | 44 | 'line' => $e->getLine(), |
| 44 | 45 | ] + $stacktrace[0]; |
| 45 | 46 | |
| 46 | - if ($stacktrace[0] != $header) { |
|
| 47 | + if ($stacktrace[0] != $header) |
|
| 48 | + { |
|
| 47 | 49 | array_unshift($stacktrace, $header); |
| 48 | 50 | } |
| 49 | 51 | |
@@ -50,10 +50,13 @@ discard block |
||
| 50 | 50 | $this->style = $style; |
| 51 | 51 | $this->dumper = new Dumper(); |
| 52 | 52 | |
| 53 | - if ($style == self::INVERTED) { |
|
| 53 | + if ($style == self::INVERTED) |
|
| 54 | + { |
|
| 54 | 55 | $this->renderer = new HtmlRenderer(HtmlRenderer::INVERTED); |
| 55 | 56 | $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::INVERTED)); |
| 56 | - } else { |
|
| 57 | + } |
|
| 58 | + else |
|
| 59 | + { |
|
| 57 | 60 | $this->renderer = new HtmlRenderer(HtmlRenderer::DEFAULT); |
| 58 | 61 | $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT)); |
| 59 | 62 | } |
@@ -105,20 +108,24 @@ discard block |
||
| 105 | 108 | 'valueWrapper' => $options['valueWrapper'], |
| 106 | 109 | ]); |
| 107 | 110 | |
| 108 | - if ($this->state !== null) { |
|
| 109 | - if ($this->state->getTags() !== []) { |
|
| 111 | + if ($this->state !== null) |
|
| 112 | + { |
|
| 113 | + if ($this->state->getTags() !== []) |
|
| 114 | + { |
|
| 110 | 115 | $options['tags'] = $this->render('partials/tags', [ |
| 111 | 116 | 'tags' => $this->state->getTags(), |
| 112 | 117 | ]); |
| 113 | 118 | } |
| 114 | 119 | |
| 115 | - if ($this->state->getLogEvents() !== []) { |
|
| 120 | + if ($this->state->getLogEvents() !== []) |
|
| 121 | + { |
|
| 116 | 122 | $options['logs'] = $this->render('partials/logs', [ |
| 117 | 123 | 'logEvents' => $this->state->getLogEvents(), |
| 118 | 124 | ]); |
| 119 | 125 | } |
| 120 | 126 | |
| 121 | - if ($this->state->getVariables() !== []) { |
|
| 127 | + if ($this->state->getVariables() !== []) |
|
| 128 | + { |
|
| 122 | 129 | $options['variables'] = $this->render('partials/variables', [ |
| 123 | 130 | 'variables' => $this->state->getVariables(), |
| 124 | 131 | ]); |