@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @throws FileOperationException |
24 | 24 | * @throws InvalidArgumentException |
25 | 25 | */ |
26 | - public function getContents(string|\Stringable $id): string; |
|
26 | + public function getContents(string | \Stringable $id): string; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * {@see BucketInterface::getStream()} |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @throws FileOperationException |
33 | 33 | * @throws InvalidArgumentException |
34 | 34 | */ |
35 | - public function getStream(string|\Stringable $id); |
|
35 | + public function getStream(string | \Stringable $id); |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * {@see BucketInterface::exists()} |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @throws FileOperationException |
41 | 41 | * @throws InvalidArgumentException |
42 | 42 | */ |
43 | - public function exists(string|\Stringable $id): bool; |
|
43 | + public function exists(string | \Stringable $id): bool; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * {@see BucketInterface::getLastModified()} |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @throws FileOperationException |
50 | 50 | * @throws InvalidArgumentException |
51 | 51 | */ |
52 | - public function getLastModified(string|\Stringable $id): int; |
|
52 | + public function getLastModified(string | \Stringable $id): int; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * {@see BucketInterface::getSize()} |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @throws FileOperationException |
59 | 59 | * @throws InvalidArgumentException |
60 | 60 | */ |
61 | - public function getSize(string|\Stringable $id): int; |
|
61 | + public function getSize(string | \Stringable $id): int; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | *{@see BucketInterface::getMimeType()} |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @throws FileOperationException |
67 | 67 | * @throws InvalidArgumentException |
68 | 68 | */ |
69 | - public function getMimeType(string|\Stringable $id): string; |
|
69 | + public function getMimeType(string | \Stringable $id): string; |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * {@see BucketInterface::getVisibility()} |
@@ -76,5 +76,5 @@ discard block |
||
76 | 76 | * @throws InvalidArgumentException |
77 | 77 | */ |
78 | 78 | #[ExpectedValues(valuesFromClass: Visibility::class)] |
79 | - public function getVisibility(string|\Stringable $id): string; |
|
79 | + public function getVisibility(string | \Stringable $id): string; |
|
80 | 80 | } |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | */ |
20 | 20 | abstract public function bucket(string $name = null): BucketInterface; |
21 | 21 | |
22 | - public function create(string|\Stringable $id, array $config = []): FileInterface |
|
22 | + public function create(string | \Stringable $id, array $config = []): FileInterface |
|
23 | 23 | { |
24 | 24 | [$name, $pathname] = $this->parseUri($id); |
25 | 25 | |
26 | 26 | return $this->bucket($name)->create($pathname, $config); |
27 | 27 | } |
28 | 28 | |
29 | - public function write(string|\Stringable $id, mixed $content, array $config = []): FileInterface |
|
29 | + public function write(string | \Stringable $id, mixed $content, array $config = []): FileInterface |
|
30 | 30 | { |
31 | 31 | [$name, $pathname] = $this->parseUri($id); |
32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function setVisibility( |
37 | - string|\Stringable $id, |
|
37 | + string | \Stringable $id, |
|
38 | 38 | #[ExpectedValues(valuesFromClass: Visibility::class)] |
39 | 39 | string $visibility |
40 | 40 | ): FileInterface { |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | public function copy( |
47 | - string|\Stringable $source, |
|
48 | - string|\Stringable $destination, |
|
47 | + string | \Stringable $source, |
|
48 | + string | \Stringable $destination, |
|
49 | 49 | array $config = [] |
50 | 50 | ): FileInterface { |
51 | 51 | [$sourceName, $sourcePathname] = $this->parseUri($source); |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | public function move( |
61 | - string|\Stringable $source, |
|
62 | - string|\Stringable $destination, |
|
61 | + string | \Stringable $source, |
|
62 | + string | \Stringable $destination, |
|
63 | 63 | array $config = [] |
64 | 64 | ): FileInterface { |
65 | 65 | [$sourceName, $sourcePathname] = $this->parseUri($source); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return $sourceStorage->move($sourcePathname, $destPathname, $destStorage, $config); |
72 | 72 | } |
73 | 73 | |
74 | - public function delete(string|\Stringable $id, bool $clean = false): void |
|
74 | + public function delete(string | \Stringable $id, bool $clean = false): void |
|
75 | 75 | { |
76 | 76 | [$name, $pathname] = $this->parseUri($id); |
77 | 77 | |
@@ -83,5 +83,5 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * {@see Storage::parseUri()} |
85 | 85 | */ |
86 | - abstract protected function parseUri(string|\Stringable $uri, bool $withScheme = true): array; |
|
86 | + abstract protected function parseUri(string | \Stringable $uri, bool $withScheme = true): array; |
|
87 | 87 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct( |
32 | 32 | private readonly ConfiguratorInterface $config |
33 | - ) { |
|
33 | + ){ |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function init(BinderInterface $binder, EnvironmentInterface $env): void |
@@ -45,18 +45,18 @@ discard block |
||
45 | 45 | BucketFactoryInterface $bucketFactory, |
46 | 46 | StorageConfig $config, |
47 | 47 | FactoryInterface $factory |
48 | - ) { |
|
48 | + ){ |
|
49 | 49 | $manager = new Storage($config->getDefaultBucket()); |
50 | 50 | |
51 | 51 | $distributions = $config->getDistributions(); |
52 | 52 | |
53 | - foreach ($config->getAdapters() as $name => $adapter) { |
|
53 | + foreach ($config->getAdapters() as $name => $adapter){ |
|
54 | 54 | $resolver = null; |
55 | 55 | |
56 | - if (isset($distributions[$name])) { |
|
57 | - try { |
|
56 | + if (isset($distributions[$name])){ |
|
57 | + try{ |
|
58 | 58 | $cdn = $factory->make(CdnInterface::class); |
59 | - } catch (NotFoundException $e) { |
|
59 | + }catch (NotFoundException $e){ |
|
60 | 60 | $message = 'Unable to create distribution for bucket "%s". ' |
61 | 61 | . 'Please make sure that bootloader %s is added in your application'; |
62 | 62 | $message = \sprintf($message, $name, DistributionBootloader::class); |
@@ -50,13 +50,18 @@ |
||
50 | 50 | |
51 | 51 | $distributions = $config->getDistributions(); |
52 | 52 | |
53 | - foreach ($config->getAdapters() as $name => $adapter) { |
|
53 | + foreach ($config->getAdapters() as $name => $adapter) |
|
54 | + { |
|
54 | 55 | $resolver = null; |
55 | 56 | |
56 | - if (isset($distributions[$name])) { |
|
57 | - try { |
|
57 | + if (isset($distributions[$name])) |
|
58 | + { |
|
59 | + try |
|
60 | + { |
|
58 | 61 | $cdn = $factory->make(CdnInterface::class); |
59 | - } catch (NotFoundException $e) { |
|
62 | + } |
|
63 | + catch (NotFoundException $e) |
|
64 | + { |
|
60 | 65 | $message = 'Unable to create distribution for bucket "%s". ' |
61 | 66 | . 'Please make sure that bootloader %s is added in your application'; |
62 | 67 | $message = \sprintf($message, $name, DistributionBootloader::class); |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | $handler = new ConsoleRenderer(); |
124 | 124 | $handler->setColorsSupport(true); |
125 | 125 | |
126 | - try { |
|
126 | + try{ |
|
127 | 127 | $this->makeException(); |
128 | - } catch (\Throwable $e) { |
|
128 | + }catch (\Throwable $e){ |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | { |
139 | 139 | $handler = new PlainRenderer(); |
140 | 140 | |
141 | - try { |
|
141 | + try{ |
|
142 | 142 | $this->makeException(); |
143 | - } catch (\Throwable $e) { |
|
143 | + }catch (\Throwable $e){ |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG); |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | { |
154 | 154 | $handler = new JsonRenderer(); |
155 | 155 | |
156 | - try { |
|
156 | + try{ |
|
157 | 157 | $this->makeException(); |
158 | - } catch (\Throwable $e) { |
|
158 | + }catch (\Throwable $e){ |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG); |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | |
167 | 167 | public function makeException(): void |
168 | 168 | { |
169 | - try { |
|
169 | + try{ |
|
170 | 170 | $f = function (): void { |
171 | 171 | throw new \RuntimeException('error'); |
172 | 172 | }; |
173 | 173 | |
174 | 174 | $f(); |
175 | - } catch (\Throwable $e) { |
|
175 | + }catch (\Throwable $e){ |
|
176 | 176 | throw new \LogicException('error', 0, $e); |
177 | 177 | } |
178 | 178 | } |
@@ -123,9 +123,12 @@ discard block |
||
123 | 123 | $handler = new ConsoleRenderer(); |
124 | 124 | $handler->setColorsSupport(true); |
125 | 125 | |
126 | - try { |
|
126 | + try |
|
127 | + { |
|
127 | 128 | $this->makeException(); |
128 | - } catch (\Throwable $e) { |
|
129 | + } |
|
130 | + catch (\Throwable $e) |
|
131 | + { |
|
129 | 132 | } |
130 | 133 | |
131 | 134 | $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG); |
@@ -138,9 +141,12 @@ discard block |
||
138 | 141 | { |
139 | 142 | $handler = new PlainRenderer(); |
140 | 143 | |
141 | - try { |
|
144 | + try |
|
145 | + { |
|
142 | 146 | $this->makeException(); |
143 | - } catch (\Throwable $e) { |
|
147 | + } |
|
148 | + catch (\Throwable $e) |
|
149 | + { |
|
144 | 150 | } |
145 | 151 | |
146 | 152 | $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG); |
@@ -153,9 +159,12 @@ discard block |
||
153 | 159 | { |
154 | 160 | $handler = new JsonRenderer(); |
155 | 161 | |
156 | - try { |
|
162 | + try |
|
163 | + { |
|
157 | 164 | $this->makeException(); |
158 | - } catch (\Throwable $e) { |
|
165 | + } |
|
166 | + catch (\Throwable $e) |
|
167 | + { |
|
159 | 168 | } |
160 | 169 | |
161 | 170 | $result = $handler->render($e, \Spiral\Exceptions\Verbosity::DEBUG); |
@@ -166,13 +175,16 @@ discard block |
||
166 | 175 | |
167 | 176 | public function makeException(): void |
168 | 177 | { |
169 | - try { |
|
178 | + try |
|
179 | + { |
|
170 | 180 | $f = function (): void { |
171 | 181 | throw new \RuntimeException('error'); |
172 | 182 | }; |
173 | 183 | |
174 | 184 | $f(); |
175 | - } catch (\Throwable $e) { |
|
185 | + } |
|
186 | + catch (\Throwable $e) |
|
187 | + { |
|
176 | 188 | throw new \LogicException('error', 0, $e); |
177 | 189 | } |
178 | 190 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $exception->getLine() |
31 | 31 | )])->once(); |
32 | 32 | |
33 | - $handler = new class extends ExceptionHandler { |
|
33 | + $handler = new class extends ExceptionHandler{ |
|
34 | 34 | protected function bootBasicHandlers(): void |
35 | 35 | { |
36 | 36 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function testReportWithoutLogger(): void |
47 | 47 | { |
48 | - $handler = new class extends ExceptionHandler { |
|
48 | + $handler = new class extends ExceptionHandler{ |
|
49 | 49 | protected function bootBasicHandlers(): void |
50 | 50 | { |
51 | 51 | } |
@@ -30,7 +30,8 @@ discard block |
||
30 | 30 | $exception->getLine() |
31 | 31 | )])->once(); |
32 | 32 | |
33 | - $handler = new class extends ExceptionHandler { |
|
33 | + $handler = new class extends ExceptionHandler |
|
34 | + { |
|
34 | 35 | protected function bootBasicHandlers(): void |
35 | 36 | { |
36 | 37 | } |
@@ -45,7 +46,8 @@ discard block |
||
45 | 46 | |
46 | 47 | public function testReportWithoutLogger(): void |
47 | 48 | { |
48 | - $handler = new class extends ExceptionHandler { |
|
49 | + $handler = new class extends ExceptionHandler |
|
50 | + { |
|
49 | 51 | protected function bootBasicHandlers(): void |
50 | 52 | { |
51 | 53 | } |
@@ -24,9 +24,11 @@ discard block |
||
24 | 24 | $lines = \explode("\n", \str_replace("\r\n", "\n", $this->highlight($source))); |
25 | 25 | |
26 | 26 | $result = ''; |
27 | - foreach ($lines as $number => $code) { |
|
27 | + foreach ($lines as $number => $code) |
|
28 | + { |
|
28 | 29 | $human = $number + 1; |
29 | - if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)) { |
|
30 | + if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)) |
|
31 | + { |
|
30 | 32 | //Not included in a range |
31 | 33 | continue; |
32 | 34 | } |
@@ -44,7 +46,8 @@ discard block |
||
44 | 46 | { |
45 | 47 | $result = ''; |
46 | 48 | $previous = []; |
47 | - foreach ($this->getTokens($source) as $token) { |
|
49 | + foreach ($this->getTokens($source) as $token) |
|
50 | + { |
|
48 | 51 | $result .= $this->renderer->token($token, $previous); |
49 | 52 | $previous = $token; |
50 | 53 | } |
@@ -60,12 +63,15 @@ discard block |
||
60 | 63 | $tokens = []; |
61 | 64 | $line = 0; |
62 | 65 | |
63 | - foreach (\token_get_all($source) as $token) { |
|
64 | - if (isset($token[2])) { |
|
66 | + foreach (\token_get_all($source) as $token) |
|
67 | + { |
|
68 | + if (isset($token[2])) |
|
69 | + { |
|
65 | 70 | $line = $token[2]; |
66 | 71 | } |
67 | 72 | |
68 | - if (!\is_array($token)) { |
|
73 | + if (!\is_array($token)) |
|
74 | + { |
|
69 | 75 | $token = [$token, $token, $line]; |
70 | 76 | } |
71 | 77 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | private readonly StyleInterface $renderer |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | $lines = \explode("\n", \str_replace("\r\n", "\n", $this->highlight($source))); |
25 | 25 | |
26 | 26 | $result = ''; |
27 | - foreach ($lines as $number => $code) { |
|
27 | + foreach ($lines as $number => $code){ |
|
28 | 28 | $human = $number + 1; |
29 | - if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)) { |
|
29 | + if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)){ |
|
30 | 30 | //Not included in a range |
31 | 31 | continue; |
32 | 32 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $result = ''; |
46 | 46 | $previous = []; |
47 | - foreach ($this->getTokens($source) as $token) { |
|
47 | + foreach ($this->getTokens($source) as $token){ |
|
48 | 48 | $result .= $this->renderer->token($token, $previous); |
49 | 49 | $previous = $token; |
50 | 50 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $tokens = []; |
61 | 61 | $line = 0; |
62 | 62 | |
63 | - foreach (\token_get_all($source) as $token) { |
|
64 | - if (isset($token[2])) { |
|
63 | + foreach (\token_get_all($source) as $token){ |
|
64 | + if (isset($token[2])){ |
|
65 | 65 | $line = $token[2]; |
66 | 66 | } |
67 | 67 | |
68 | - if (!\is_array($token)) { |
|
68 | + if (!\is_array($token)){ |
|
69 | 69 | $token = [$token, $token, $line]; |
70 | 70 | } |
71 | 71 |
@@ -30,24 +30,24 @@ |
||
30 | 30 | |
31 | 31 | private function renderTrace(array $trace, Verbosity $verbosity): \Generator |
32 | 32 | { |
33 | - foreach ($trace as $item) { |
|
33 | + foreach ($trace as $item){ |
|
34 | 34 | $result = []; |
35 | 35 | |
36 | - if (isset($item['class'])) { |
|
36 | + if (isset($item['class'])){ |
|
37 | 37 | $result['function'] = \sprintf( |
38 | 38 | '%s%s%s()', |
39 | 39 | $item['class'], |
40 | 40 | $item['type'], |
41 | 41 | $item['function'] |
42 | 42 | ); |
43 | - } else { |
|
43 | + }else{ |
|
44 | 44 | $result['function'] = \sprintf( |
45 | 45 | '%s()', |
46 | 46 | $item['function'] |
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
50 | - if ($verbosity->value >= Verbosity::VERBOSE->value && isset($item['file'])) { |
|
50 | + if ($verbosity->value >= Verbosity::VERBOSE->value && isset($item['file'])){ |
|
51 | 51 | $result['at'] = [ |
52 | 52 | 'file' => $item['file'] ?? null, |
53 | 53 | 'line' => $item['line'] ?? null, |
@@ -30,24 +30,29 @@ |
||
30 | 30 | |
31 | 31 | private function renderTrace(array $trace, Verbosity $verbosity): \Generator |
32 | 32 | { |
33 | - foreach ($trace as $item) { |
|
33 | + foreach ($trace as $item) |
|
34 | + { |
|
34 | 35 | $result = []; |
35 | 36 | |
36 | - if (isset($item['class'])) { |
|
37 | + if (isset($item['class'])) |
|
38 | + { |
|
37 | 39 | $result['function'] = \sprintf( |
38 | 40 | '%s%s%s()', |
39 | 41 | $item['class'], |
40 | 42 | $item['type'], |
41 | 43 | $item['function'] |
42 | 44 | ); |
43 | - } else { |
|
45 | + } |
|
46 | + else |
|
47 | + { |
|
44 | 48 | $result['function'] = \sprintf( |
45 | 49 | '%s()', |
46 | 50 | $item['function'] |
47 | 51 | ); |
48 | 52 | } |
49 | 53 | |
50 | - if ($verbosity->value >= Verbosity::VERBOSE->value && isset($item['file'])) { |
|
54 | + if ($verbosity->value >= Verbosity::VERBOSE->value && isset($item['file'])) |
|
55 | + { |
|
51 | 56 | $result['at'] = [ |
52 | 57 | 'file' => $item['file'] ?? null, |
53 | 58 | 'line' => $item['line'] ?? null, |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | protected function getStacktrace(\Throwable $e): array |
28 | 28 | { |
29 | 29 | $stacktrace = $e->getTrace(); |
30 | - if (empty($stacktrace)) { |
|
30 | + if (empty($stacktrace)){ |
|
31 | 31 | return []; |
32 | 32 | } |
33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'line' => $e->getLine(), |
38 | 38 | ] + $stacktrace[0]; |
39 | 39 | |
40 | - if ($stacktrace[0] !== $header) { |
|
40 | + if ($stacktrace[0] !== $header){ |
|
41 | 41 | \array_unshift($stacktrace, $header); |
42 | 42 | } |
43 | 43 |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | protected function getStacktrace(\Throwable $e): array |
28 | 28 | { |
29 | 29 | $stacktrace = $e->getTrace(); |
30 | - if (empty($stacktrace)) { |
|
30 | + if (empty($stacktrace)) |
|
31 | + { |
|
31 | 32 | return []; |
32 | 33 | } |
33 | 34 | |
@@ -37,7 +38,8 @@ discard block |
||
37 | 38 | 'line' => $e->getLine(), |
38 | 39 | ] + $stacktrace[0]; |
39 | 40 | |
40 | - if ($stacktrace[0] !== $header) { |
|
41 | + if ($stacktrace[0] !== $header) |
|
42 | + { |
|
41 | 43 | \array_unshift($stacktrace, $header); |
42 | 44 | } |
43 | 45 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | class ConsoleStyle implements StyleInterface |
14 | 14 | { |
15 | 15 | protected array $templates = [ |
16 | - 'token' => '%s%s' . Color::RESET, |
|
17 | - 'line' => Color::LIGHT_CYAN . ' %s ' . Color::RESET . " %s\n", |
|
18 | - 'active' => Color::BG_RED . ' ' . Color::LIGHT_WHITE . '%s ' . Color::RESET . " %s\n", |
|
16 | + 'token' => '%s%s'.Color::RESET, |
|
17 | + 'line' => Color::LIGHT_CYAN.' %s '.Color::RESET." %s\n", |
|
18 | + 'active' => Color::BG_RED.' '.Color::LIGHT_WHITE.'%s '.Color::RESET." %s\n", |
|
19 | 19 | ]; |
20 | 20 | |
21 | 21 | protected array $style = [ |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | T_VARIABLE, |
79 | 79 | ], |
80 | 80 | Color::LIGHT_YELLOW => [ |
81 | - '->' . T_STRING, |
|
82 | - '::' . T_STRING, |
|
81 | + '->'.T_STRING, |
|
82 | + '::'.T_STRING, |
|
83 | 83 | ], |
84 | 84 | ]; |
85 | 85 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | { |
88 | 88 | $style = $this->getStyle($token, $previous); |
89 | 89 | |
90 | - if (!\str_contains((string) $token[1], "\n")) { |
|
90 | + if (!\str_contains((string)$token[1], "\n")){ |
|
91 | 91 | return \sprintf($this->templates['token'], $style, $token[1]); |
92 | 92 | } |
93 | 93 | |
94 | 94 | $lines = []; |
95 | - foreach (\explode("\n", (string) $token[1]) as $line) { |
|
95 | + foreach (\explode("\n", (string)$token[1]) as $line){ |
|
96 | 96 | $lines[] = \sprintf($this->templates['token'], $style, $line); |
97 | 97 | } |
98 | 98 | |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function getStyle(array $token, array $previous): string |
115 | 115 | { |
116 | - if (!empty($previous)) { |
|
117 | - foreach ($this->style as $style => $tokens) { |
|
118 | - if (\in_array($previous[1] . $token[0], $tokens)) { |
|
116 | + if (!empty($previous)){ |
|
117 | + foreach ($this->style as $style => $tokens){ |
|
118 | + if (\in_array($previous[1].$token[0], $tokens)){ |
|
119 | 119 | return $style; |
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - foreach ($this->style as $style => $tokens) { |
|
125 | - if (\in_array($token[0], $tokens)) { |
|
124 | + foreach ($this->style as $style => $tokens){ |
|
125 | + if (\in_array($token[0], $tokens)){ |
|
126 | 126 | return $style; |
127 | 127 | } |
128 | 128 | } |
@@ -87,12 +87,14 @@ discard block |
||
87 | 87 | { |
88 | 88 | $style = $this->getStyle($token, $previous); |
89 | 89 | |
90 | - if (!\str_contains((string) $token[1], "\n")) { |
|
90 | + if (!\str_contains((string) $token[1], "\n")) |
|
91 | + { |
|
91 | 92 | return \sprintf($this->templates['token'], $style, $token[1]); |
92 | 93 | } |
93 | 94 | |
94 | 95 | $lines = []; |
95 | - foreach (\explode("\n", (string) $token[1]) as $line) { |
|
96 | + foreach (\explode("\n", (string) $token[1]) as $line) |
|
97 | + { |
|
96 | 98 | $lines[] = \sprintf($this->templates['token'], $style, $line); |
97 | 99 | } |
98 | 100 | |
@@ -113,16 +115,21 @@ discard block |
||
113 | 115 | */ |
114 | 116 | private function getStyle(array $token, array $previous): string |
115 | 117 | { |
116 | - if (!empty($previous)) { |
|
117 | - foreach ($this->style as $style => $tokens) { |
|
118 | - if (\in_array($previous[1] . $token[0], $tokens)) { |
|
118 | + if (!empty($previous)) |
|
119 | + { |
|
120 | + foreach ($this->style as $style => $tokens) |
|
121 | + { |
|
122 | + if (\in_array($previous[1] . $token[0], $tokens)) |
|
123 | + { |
|
119 | 124 | return $style; |
120 | 125 | } |
121 | 126 | } |
122 | 127 | } |
123 | 128 | |
124 | - foreach ($this->style as $style => $tokens) { |
|
125 | - if (\in_array($token[0], $tokens)) { |
|
129 | + foreach ($this->style as $style => $tokens) |
|
130 | + { |
|
131 | + if (\in_array($token[0], $tokens)) |
|
132 | + { |
|
126 | 133 | return $style; |
127 | 134 | } |
128 | 135 | } |