@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function get(string $name): Parameter |
| 40 | 40 | { |
| 41 | - if (!$this->has($name)) { |
|
| 41 | + if (!$this->has($name)){ |
|
| 42 | 42 | //Automatically creating constant |
| 43 | 43 | $parameter = new Parameter($name); |
| 44 | 44 | $this->add($parameter); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * Overwriting parent call. |
| 59 | 59 | */ |
| 60 | 60 | $parameters = []; |
| 61 | - foreach ($this->getIterator() as $element) { |
|
| 61 | + foreach ($this->getIterator() as $element){ |
|
| 62 | 62 | $parameters[] = $element->render(0); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -38,7 +38,8 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function get(string $name): Parameter |
| 40 | 40 | { |
| 41 | - if (!$this->has($name)) { |
|
| 41 | + if (!$this->has($name)) |
|
| 42 | + { |
|
| 42 | 43 | //Automatically creating constant |
| 43 | 44 | $parameter = new Parameter($name); |
| 44 | 45 | $this->add($parameter); |
@@ -58,7 +59,8 @@ discard block |
||
| 58 | 59 | * Overwriting parent call. |
| 59 | 60 | */ |
| 60 | 61 | $parameters = []; |
| 61 | - foreach ($this->getIterator() as $element) { |
|
| 62 | + foreach ($this->getIterator() as $element) |
|
| 63 | + { |
|
| 62 | 64 | $parameters[] = $element->render(0); |
| 63 | 65 | } |
| 64 | 66 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function get(string $name): Constant |
| 40 | 40 | { |
| 41 | - if (!$this->has($name)) { |
|
| 41 | + if (!$this->has($name)){ |
|
| 42 | 42 | $constant = new Constant($name, null); |
| 43 | 43 | $this->add($constant); |
| 44 | 44 | |
@@ -38,7 +38,8 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function get(string $name): Constant |
| 40 | 40 | { |
| 41 | - if (!$this->has($name)) { |
|
| 41 | + if (!$this->has($name)) |
|
| 42 | + { |
|
| 42 | 43 | $constant = new Constant($name, null); |
| 43 | 44 | $this->add($constant); |
| 44 | 45 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function get(string $name): Property |
| 40 | 40 | { |
| 41 | - if (!$this->has($name)) { |
|
| 41 | + if (!$this->has($name)){ |
|
| 42 | 42 | //Automatically creating constant |
| 43 | 43 | $property = new Property($name); |
| 44 | 44 | $this->add($property); |
@@ -38,7 +38,8 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function get(string $name): Property |
| 40 | 40 | { |
| 41 | - if (!$this->has($name)) { |
|
| 41 | + if (!$this->has($name)) |
|
| 42 | + { |
|
| 42 | 43 | //Automatically creating constant |
| 43 | 44 | $property = new Property($name); |
| 44 | 45 | $this->add($property); |
@@ -34,13 +34,13 @@ 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 | $databases = [$this->argument('db')]; |
| 39 | - } else { |
|
| 39 | + }else{ |
|
| 40 | 40 | $databases = array_keys($config->getDatabases()); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (empty($databases)) { |
|
| 43 | + if (empty($databases)){ |
|
| 44 | 44 | $this->writeln('<fg=red>No databases found.</fg=red>'); |
| 45 | 45 | |
| 46 | 46 | return; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ] |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - foreach ($databases as $database) { |
|
| 61 | + foreach ($databases as $database){ |
|
| 62 | 62 | $database = $dbal->database($database); |
| 63 | 63 | |
| 64 | 64 | /** @var Driver $driver */ |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | $database->getPrefix() ?: '<comment>---</comment>', |
| 72 | 72 | ]; |
| 73 | 73 | |
| 74 | - try { |
|
| 74 | + try{ |
|
| 75 | 75 | $driver->connect(); |
| 76 | - } catch (\Exception $exception) { |
|
| 76 | + }catch (\Exception $exception){ |
|
| 77 | 77 | $this->renderException($grid, $header, $exception); |
| 78 | 78 | |
| 79 | - if ($database->getName() != end($databases)) { |
|
| 79 | + if ($database->getName() != end($databases)){ |
|
| 80 | 80 | $grid->addRow(new TableSeparator()); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $header[] = '<info>connected</info>'; |
| 87 | 87 | $this->renderTables($grid, $header, $database); |
| 88 | - if ($database->getName() != end($databases)) { |
|
| 88 | + if ($database->getName() != end($databases)){ |
|
| 89 | 89 | $grid->addRow(new TableSeparator()); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function renderTables(Table $grid, array $header, Database $database): void |
| 121 | 121 | { |
| 122 | - foreach ($database->getTables() as $table) { |
|
| 122 | + foreach ($database->getTables() as $table){ |
|
| 123 | 123 | $grid->addRow( |
| 124 | 124 | array_merge( |
| 125 | 125 | $header, |
@@ -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, |
@@ -72,7 +72,7 @@ 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 | return false; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function url_stat($path, $flags) |
| 158 | 158 | { |
| 159 | - if (!isset(self::$uris[$path])) { |
|
| 159 | + if (!isset(self::$uris[$path])){ |
|
| 160 | 160 | return null; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public static function register() |
| 170 | 170 | { |
| 171 | - if (self::$registered) { |
|
| 171 | + if (self::$registered){ |
|
| 172 | 172 | return; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public static function has($file) |
| 186 | 186 | { |
| 187 | - if ($file instanceof StreamInterface) { |
|
| 188 | - $file = 'spiral://' . spl_object_hash($file); |
|
| 187 | + if ($file instanceof StreamInterface){ |
|
| 188 | + $file = 'spiral://'.spl_object_hash($file); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | return isset(self::$uris[$file]); |
@@ -202,15 +202,15 @@ discard block |
||
| 202 | 202 | public static function getResource(StreamInterface $stream) |
| 203 | 203 | { |
| 204 | 204 | $mode = null; |
| 205 | - if ($stream->isReadable()) { |
|
| 205 | + if ($stream->isReadable()){ |
|
| 206 | 206 | $mode = 'r'; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if ($stream->isWritable()) { |
|
| 209 | + if ($stream->isWritable()){ |
|
| 210 | 210 | $mode = !empty($mode) ? 'r+' : 'w'; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if (empty($mode)) { |
|
| 213 | + if (empty($mode)){ |
|
| 214 | 214 | throw new WrapperException('Stream is not available in read or write modes'); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | self::register(); |
| 229 | 229 | |
| 230 | - $uri = 'spiral://' . spl_object_hash($stream); |
|
| 230 | + $uri = 'spiral://'.spl_object_hash($stream); |
|
| 231 | 231 | self::$uris[$uri] = $stream; |
| 232 | 232 | |
| 233 | 233 | return $uri; |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public static function release($file) |
| 243 | 243 | { |
| 244 | - if ($file instanceof StreamInterface) { |
|
| 245 | - $file = 'spiral://' . spl_object_hash($file); |
|
| 244 | + if ($file instanceof StreamInterface){ |
|
| 245 | + $file = 'spiral://'.spl_object_hash($file); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | unset(self::$uris[$file]); |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | private function getStreamStats(StreamInterface $stream) |
| 258 | 258 | { |
| 259 | 259 | $mode = $this->mode; |
| 260 | - if (empty($mode)) { |
|
| 261 | - if ($stream->isReadable()) { |
|
| 260 | + if (empty($mode)){ |
|
| 261 | + if ($stream->isReadable()){ |
|
| 262 | 262 | $mode = 'r'; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if ($stream->isWritable()) { |
|
| 265 | + if ($stream->isWritable()){ |
|
| 266 | 266 | $mode = !empty($mode) ? 'r+' : 'w'; |
| 267 | 267 | } |
| 268 | 268 | } |
@@ -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 | } |
@@ -33,7 +33,7 @@ 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 | return []; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'line' => $e->getLine(), |
| 44 | 44 | ] + $stacktrace[0]; |
| 45 | 45 | |
| 46 | - if ($stacktrace[0] != $header) { |
|
| 46 | + if ($stacktrace[0] != $header){ |
|
| 47 | 47 | array_unshift($stacktrace, $header); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -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,10 @@ 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 | $this->renderer = new HtmlRenderer(HtmlRenderer::INVERTED); |
| 55 | 55 | $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::INVERTED)); |
| 56 | - } else { |
|
| 56 | + }else{ |
|
| 57 | 57 | $this->renderer = new HtmlRenderer(HtmlRenderer::DEFAULT); |
| 58 | 58 | $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT)); |
| 59 | 59 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | 'message' => $this->getMessage($e), |
| 83 | 83 | 'exception' => $e, |
| 84 | 84 | 'valueWrapper' => new ValueWrapper($this->dumper, $this->renderer, $verbosity), |
| 85 | - 'style' => $this->render('styles/' . $this->style), |
|
| 85 | + 'style' => $this->render('styles/'.$this->style), |
|
| 86 | 86 | 'footer' => $this->render('partials/footer'), |
| 87 | 87 | 'variables' => '', |
| 88 | 88 | 'logs' => '', |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | 'valueWrapper' => $options['valueWrapper'], |
| 106 | 106 | ]); |
| 107 | 107 | |
| 108 | - if ($this->state !== null) { |
|
| 109 | - if ($this->state->getTags() !== []) { |
|
| 108 | + if ($this->state !== null){ |
|
| 109 | + if ($this->state->getTags() !== []){ |
|
| 110 | 110 | $options['tags'] = $this->render('partials/tags', [ |
| 111 | 111 | 'tags' => $this->state->getTags(), |
| 112 | 112 | ]); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ($this->state->getLogEvents() !== []) { |
|
| 115 | + if ($this->state->getLogEvents() !== []){ |
|
| 116 | 116 | $options['logs'] = $this->render('partials/logs', [ |
| 117 | 117 | 'logEvents' => $this->state->getLogEvents(), |
| 118 | 118 | ]); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ($this->state->getVariables() !== []) { |
|
| 121 | + if ($this->state->getVariables() !== []){ |
|
| 122 | 122 | $options['variables'] = $this->render('partials/variables', [ |
| 123 | 123 | 'variables' => $this->state->getVariables(), |
| 124 | 124 | ]); |
@@ -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 | ]); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * Visual styles. |
| 26 | 26 | */ |
| 27 | - public const DEFAULT = 'default'; |
|
| 27 | + public const default = 'default'; |
|
| 28 | 28 | public const INVERTED = 'inverted'; |
| 29 | 29 | |
| 30 | 30 | /** @var HtmlRenderer */ |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | protected $highlighter; |
| 35 | 35 | |
| 36 | 36 | /** @var string */ |
| 37 | - protected $style = self::DEFAULT; |
|
| 37 | + protected $style = self::default; |
|
| 38 | 38 | |
| 39 | 39 | /** @var Dumper */ |
| 40 | 40 | protected $dumper; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** @var StateInterface|null */ |
| 43 | 43 | protected $state; |
| 44 | 44 | |
| 45 | - public function __construct(string $style = self::DEFAULT) |
|
| 45 | + public function __construct(string $style = self::default) |
|
| 46 | 46 | { |
| 47 | 47 | $this->style = $style; |
| 48 | 48 | $this->dumper = new Dumper(); |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | $this->renderer = new HtmlRenderer(HtmlRenderer::INVERTED); |
| 52 | 52 | $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::INVERTED)); |
| 53 | 53 | } else { |
| 54 | - $this->renderer = new HtmlRenderer(HtmlRenderer::DEFAULT); |
|
| 55 | - $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT)); |
|
| 54 | + $this->renderer = new HtmlRenderer(HtmlRenderer::default); |
|
| 55 | + $this->highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default)); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $this->dumper->setRenderer(Dumper::RETURN, $this->renderer); |
|
| 58 | + $this->dumper->setRenderer(Dumper::return, $this->renderer); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function withState(StateInterface $state): HandlerInterface |
@@ -50,18 +50,21 @@ |
||
| 50 | 50 | public function execute(ContainerInterface $container, OutputInterface $output): void |
| 51 | 51 | { |
| 52 | 52 | $function = $this->function; |
| 53 | - if (is_string($function) && strpos($function, ':') !== false) { |
|
| 53 | + if (is_string($function) && strpos($function, ':') !== false) |
|
| 54 | + { |
|
| 54 | 55 | $function = explode(':', str_replace('::', ':', $function)); |
| 55 | 56 | } |
| 56 | 57 | |
| 57 | - if (is_array($function) && isset($function[0]) && !is_object($function[0])) { |
|
| 58 | + if (is_array($function) && isset($function[0]) && !is_object($function[0])) |
|
| 59 | + { |
|
| 58 | 60 | $function[0] = $container->get($function[0]); |
| 59 | 61 | } |
| 60 | 62 | |
| 61 | 63 | /** @var ResolverInterface $resolver */ |
| 62 | 64 | $resolver = $container->get(ResolverInterface::class); |
| 63 | 65 | |
| 64 | - if (is_array($function)) { |
|
| 66 | + if (is_array($function)) |
|
| 67 | + { |
|
| 65 | 68 | $reflection = new \ReflectionMethod($function[0], $function[1]); |
| 66 | 69 | $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [ |
| 67 | 70 | 'output' => $output, |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | array $parameters = [], |
| 32 | 32 | string $header = '', |
| 33 | 33 | string $footer = '' |
| 34 | - ) { |
|
| 34 | + ){ |
|
| 35 | 35 | $this->function = $function; |
| 36 | 36 | |
| 37 | 37 | parent::__construct($header, $footer); |
@@ -43,18 +43,18 @@ discard block |
||
| 43 | 43 | public function execute(ContainerInterface $container, OutputInterface $output): void |
| 44 | 44 | { |
| 45 | 45 | $function = $this->function; |
| 46 | - if (is_string($function) && strpos($function, ':') !== false) { |
|
| 46 | + if (is_string($function) && strpos($function, ':') !== false){ |
|
| 47 | 47 | $function = explode(':', str_replace('::', ':', $function)); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (is_array($function) && isset($function[0]) && !is_object($function[0])) { |
|
| 50 | + if (is_array($function) && isset($function[0]) && !is_object($function[0])){ |
|
| 51 | 51 | $function[0] = $container->get($function[0]); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** @var ResolverInterface $resolver */ |
| 55 | 55 | $resolver = $container->get(ResolverInterface::class); |
| 56 | 56 | |
| 57 | - if (is_array($function)) { |
|
| 57 | + if (is_array($function)){ |
|
| 58 | 58 | $reflection = new \ReflectionMethod($function[0], $function[1]); |
| 59 | 59 | $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [ |
| 60 | 60 | 'output' => $output, |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use Spiral\Debug\Dumper; |
| 13 | 13 | |
| 14 | -if (!function_exists('dump')) { |
|
| 14 | +if (!function_exists('dump')){ |
|
| 15 | 15 | /** |
| 16 | 16 | * Dump value. |
| 17 | 17 | * |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | function dump($value, int $output = Dumper::OUTPUT): ?string |
| 24 | 24 | { |
| 25 | - if (!class_exists(\Spiral\Core\ContainerScope::class)) { |
|
| 25 | + if (!class_exists(\Spiral\Core\ContainerScope::class)){ |
|
| 26 | 26 | return (new Dumper())->dump($value, $output); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $container = \Spiral\Core\ContainerScope::getContainer(); |
| 30 | - if (is_null($container) || !$container->has(Dumper::class)) { |
|
| 30 | + if (is_null($container) || !$container->has(Dumper::class)){ |
|
| 31 | 31 | $dumper = new Dumper(); |
| 32 | 32 | |
| 33 | 33 | return $dumper->dump($value, $output); |
@@ -11,7 +11,8 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | use Spiral\Debug\Dumper; |
| 13 | 13 | |
| 14 | -if (!function_exists('dump')) { |
|
| 14 | +if (!function_exists('dump')) |
|
| 15 | +{ |
|
| 15 | 16 | /** |
| 16 | 17 | * Dump value. |
| 17 | 18 | * |
@@ -22,12 +23,14 @@ discard block |
||
| 22 | 23 | */ |
| 23 | 24 | function dump($value, int $output = Dumper::OUTPUT): ?string |
| 24 | 25 | { |
| 25 | - if (!class_exists(\Spiral\Core\ContainerScope::class)) { |
|
| 26 | + if (!class_exists(\Spiral\Core\ContainerScope::class)) |
|
| 27 | + { |
|
| 26 | 28 | return (new Dumper())->dump($value, $output); |
| 27 | 29 | } |
| 28 | 30 | |
| 29 | 31 | $container = \Spiral\Core\ContainerScope::getContainer(); |
| 30 | - if (is_null($container) || !$container->has(Dumper::class)) { |
|
| 32 | + if (is_null($container) || !$container->has(Dumper::class)) |
|
| 33 | + { |
|
| 31 | 34 | $dumper = new Dumper(); |
| 32 | 35 | |
| 33 | 36 | return $dumper->dump($value, $output); |