@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | { |
45 | 45 | $filename = $this->getFilename($section); |
46 | 46 | |
47 | - if (!file_exists($filename)) { |
|
47 | + if (!file_exists($filename)){ |
|
48 | 48 | return null; |
49 | 49 | } |
50 | 50 | |
51 | - try { |
|
51 | + try{ |
|
52 | 52 | return include($filename); |
53 | - } catch (\Throwable $e) { |
|
53 | + }catch (\Throwable $e){ |
|
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $this->files->write( |
64 | 64 | $this->getFilename($section), |
65 | - '<?php return ' . var_export($data, true) . ';', |
|
65 | + '<?php return '.var_export($data, true).';', |
|
66 | 66 | FilesInterface::RUNTIME, |
67 | 67 | true |
68 | 68 | ); |
@@ -44,13 +44,17 @@ |
||
44 | 44 | { |
45 | 45 | $filename = $this->getFilename($section); |
46 | 46 | |
47 | - if (!file_exists($filename)) { |
|
47 | + if (!file_exists($filename)) |
|
48 | + { |
|
48 | 49 | return null; |
49 | 50 | } |
50 | 51 | |
51 | - try { |
|
52 | + try |
|
53 | + { |
|
52 | 54 | return include($filename); |
53 | - } catch (\Throwable $e) { |
|
55 | + } |
|
56 | + catch (\Throwable $e) |
|
57 | + { |
|
54 | 58 | return null; |
55 | 59 | } |
56 | 60 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Spiral\Core\ContainerScope; |
17 | 17 | use Spiral\Core\Exception\ScopeException; |
18 | 18 | |
19 | -if (!function_exists('spiral')) { |
|
19 | +if (!function_exists('spiral')){ |
|
20 | 20 | /** |
21 | 21 | * Resolve given alias in current IoC scope. |
22 | 22 | * |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function spiral(string $alias) |
29 | 29 | { |
30 | - if (ContainerScope::getContainer() === null) { |
|
30 | + if (ContainerScope::getContainer() === null){ |
|
31 | 31 | throw new ScopeException('Container scope was not set.'); |
32 | 32 | } |
33 | 33 | |
34 | - try { |
|
34 | + try{ |
|
35 | 35 | return ContainerScope::getContainer()->get($alias); |
36 | - } catch (ContainerExceptionInterface $e) { |
|
36 | + }catch (ContainerExceptionInterface $e){ |
|
37 | 37 | throw new ScopeException($e->getMessage(), $e->getCode(), $e); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -if (!function_exists('directory')) { |
|
42 | +if (!function_exists('directory')){ |
|
43 | 43 | /** |
44 | 44 | * Get directory alias value. Uses application core from the current global scope. |
45 | 45 | * |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -if (!function_exists('env')) { |
|
58 | +if (!function_exists('env')){ |
|
59 | 59 | /** |
60 | 60 | * Gets the value of an environment variable. Uses application core from the current global scope. |
61 | 61 | * |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | use Spiral\Core\ContainerScope; |
17 | 17 | use Spiral\Core\Exception\ScopeException; |
18 | 18 | |
19 | -if (!function_exists('spiral')) { |
|
19 | +if (!function_exists('spiral')) |
|
20 | +{ |
|
20 | 21 | /** |
21 | 22 | * Resolve given alias in current IoC scope. |
22 | 23 | * |
@@ -27,19 +28,24 @@ discard block |
||
27 | 28 | */ |
28 | 29 | function spiral(string $alias) |
29 | 30 | { |
30 | - if (ContainerScope::getContainer() === null) { |
|
31 | + if (ContainerScope::getContainer() === null) |
|
32 | + { |
|
31 | 33 | throw new ScopeException('Container scope was not set.'); |
32 | 34 | } |
33 | 35 | |
34 | - try { |
|
36 | + try |
|
37 | + { |
|
35 | 38 | return ContainerScope::getContainer()->get($alias); |
36 | - } catch (ContainerExceptionInterface $e) { |
|
39 | + } |
|
40 | + catch (ContainerExceptionInterface $e) |
|
41 | + { |
|
37 | 42 | throw new ScopeException($e->getMessage(), $e->getCode(), $e); |
38 | 43 | } |
39 | 44 | } |
40 | 45 | } |
41 | 46 | |
42 | -if (!function_exists('directory')) { |
|
47 | +if (!function_exists('directory')) |
|
48 | +{ |
|
43 | 49 | /** |
44 | 50 | * Get directory alias value. Uses application core from the current global scope. |
45 | 51 | * |
@@ -55,7 +61,8 @@ discard block |
||
55 | 61 | } |
56 | 62 | } |
57 | 63 | |
58 | -if (!function_exists('env')) { |
|
64 | +if (!function_exists('env')) |
|
65 | +{ |
|
59 | 66 | /** |
60 | 67 | * Gets the value of an environment variable. Uses application core from the current global scope. |
61 | 68 | * |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function serve() |
99 | 99 | { |
100 | - foreach ($this->dispatchers as $dispatcher) { |
|
101 | - if ($dispatcher->canServe()) { |
|
100 | + foreach ($this->dispatchers as $dispatcher){ |
|
101 | + if ($dispatcher->canServe()){ |
|
102 | 102 | return $this->container->runScope( |
103 | 103 | [DispatcherInterface::class => $dispatcher], |
104 | 104 | [$dispatcher, 'serve'] |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | EnvironmentInterface $environment = null, |
125 | 125 | bool $handleErrors = true |
126 | 126 | ): ?self { |
127 | - if ($handleErrors) { |
|
127 | + if ($handleErrors){ |
|
128 | 128 | ExceptionHandler::register(); |
129 | 129 | } |
130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $core = new static(new Container(), $directories); |
134 | 134 | $core->container->bindSingleton(EnvironmentInterface::class, $environment); |
135 | 135 | |
136 | - try { |
|
136 | + try{ |
|
137 | 137 | // will protect any against env overwrite action |
138 | 138 | $core->container->runScope( |
139 | 139 | [EnvironmentInterface::class => $environment], |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $core->bootstrap(); |
143 | 143 | } |
144 | 144 | ); |
145 | - } catch (\Throwable $e) { |
|
145 | + }catch (\Throwable $e){ |
|
146 | 146 | ExceptionHandler::handleException($e); |
147 | 147 | |
148 | 148 | return null; |
@@ -97,8 +97,10 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function serve() |
99 | 99 | { |
100 | - foreach ($this->dispatchers as $dispatcher) { |
|
101 | - if ($dispatcher->canServe()) { |
|
100 | + foreach ($this->dispatchers as $dispatcher) |
|
101 | + { |
|
102 | + if ($dispatcher->canServe()) |
|
103 | + { |
|
102 | 104 | return $this->container->runScope( |
103 | 105 | [DispatcherInterface::class => $dispatcher], |
104 | 106 | [$dispatcher, 'serve'] |
@@ -124,7 +126,8 @@ discard block |
||
124 | 126 | EnvironmentInterface $environment = null, |
125 | 127 | bool $handleErrors = true |
126 | 128 | ): ?self { |
127 | - if ($handleErrors) { |
|
129 | + if ($handleErrors) |
|
130 | + { |
|
128 | 131 | ExceptionHandler::register(); |
129 | 132 | } |
130 | 133 | |
@@ -133,7 +136,8 @@ discard block |
||
133 | 136 | $core = new static(new Container(), $directories); |
134 | 137 | $core->container->bindSingleton(EnvironmentInterface::class, $environment); |
135 | 138 | |
136 | - try { |
|
139 | + try |
|
140 | + { |
|
137 | 141 | // will protect any against env overwrite action |
138 | 142 | $core->container->runScope( |
139 | 143 | [EnvironmentInterface::class => $environment], |
@@ -142,7 +146,9 @@ discard block |
||
142 | 146 | $core->bootstrap(); |
143 | 147 | } |
144 | 148 | ); |
145 | - } catch (\Throwable $e) { |
|
149 | + } |
|
150 | + catch (\Throwable $e) |
|
151 | + { |
|
146 | 152 | ExceptionHandler::handleException($e); |
147 | 153 | |
148 | 154 | return null; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function testHtmlHighlighter(): void |
30 | 30 | { |
31 | - $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT)); |
|
31 | + $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default)); |
|
32 | 32 | |
33 | 33 | $this->assertStringContainsString('HighlighterTest', $highlighter->highlight(file_get_contents(__FILE__))); |
34 | 34 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function testHtmlHighlighterLines(): void |
61 | 61 | { |
62 | - $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::DEFAULT)); |
|
62 | + $highlighter = new Highlighter(new HtmlStyle(HtmlStyle::default)); |
|
63 | 63 | |
64 | 64 | $this->assertStringContainsString( |
65 | 65 | 'HighlighterTest', |
@@ -47,7 +47,7 @@ |
||
47 | 47 | </div> |
48 | 48 | </div> |
49 | 49 | <?php |
50 | - foreach ($valueWrapper->getValues() as $id => $content) { |
|
50 | + foreach ($valueWrapper->getValues() as $id => $content){ |
|
51 | 51 | echo "<div id=\"argument-{$id}\" style=\"display: none\">{$content}</div>"; |
52 | 52 | } |
53 | 53 | ?> |
@@ -47,7 +47,8 @@ |
||
47 | 47 | </div> |
48 | 48 | </div> |
49 | 49 | <?php |
50 | - foreach ($valueWrapper->getValues() as $id => $content) { |
|
50 | + foreach ($valueWrapper->getValues() as $id => $content) |
|
51 | + { |
|
51 | 52 | echo "<div id=\"argument-{$id}\" style=\"display: none\">{$content}</div>"; |
52 | 53 | } |
53 | 54 | ?> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <div class="tags"> |
2 | 2 | <div class="container"> |
3 | 3 | <?php |
4 | - foreach ($tags as $tag => $value) { |
|
4 | + foreach ($tags as $tag => $value){ |
|
5 | 5 | echo sprintf( |
6 | 6 | '<div class="tag"><div class="name">%s</div><div class="value">%s</div></div>', |
7 | 7 | $tag, |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <div class="tags"> |
2 | 2 | <div class="container"> |
3 | 3 | <?php |
4 | - foreach ($tags as $tag => $value) { |
|
4 | + foreach ($tags as $tag => $value) |
|
5 | + { |
|
5 | 6 | echo sprintf( |
6 | 7 | '<div class="tag"><div class="name">%s</div><div class="value">%s</div></div>', |
7 | 8 | $tag, |
@@ -5,7 +5,7 @@ |
||
5 | 5 | <table> |
6 | 6 | <?php |
7 | 7 | /** @var \Spiral\Logger\Event\LogEvent $log */ |
8 | - foreach ($logEvents as $log) { |
|
8 | + foreach ($logEvents as $log){ |
|
9 | 9 | echo sprintf( |
10 | 10 | '<tr><td class="channel">%s</td><td class="message">%s</td></tr>', |
11 | 11 | $log->getChannel(), |
@@ -5,7 +5,8 @@ |
||
5 | 5 | <table> |
6 | 6 | <?php |
7 | 7 | /** @var \Spiral\Logger\Event\LogEvent $log */ |
8 | - foreach ($logEvents as $log) { |
|
8 | + foreach ($logEvents as $log) |
|
9 | + { |
|
9 | 10 | echo sprintf( |
10 | 11 | '<tr><td class="channel">%s</td><td class="message">%s</td></tr>', |
11 | 12 | $log->getChannel(), |
@@ -6,12 +6,12 @@ |
||
6 | 6 | </div> |
7 | 7 | <div class="dump" id="<?= md5($name) ?>-variables" style="display: none;"> |
8 | 8 | <?php |
9 | - if (!is_array($content)) { |
|
9 | + if (!is_array($content)){ |
|
10 | 10 | echo is_scalar($value) ? htmlspecialchars($value) : json_encode($value, JSON_PRETTY_PRINT); |
11 | - } else { ?> |
|
11 | + }else{ ?> |
|
12 | 12 | <table> |
13 | 13 | <?php |
14 | - foreach ($content as $key => $value) { |
|
14 | + foreach ($content as $key => $value){ |
|
15 | 15 | // todo: values |
16 | 16 | echo sprintf( |
17 | 17 | '<tr><td class="name">%s</td><td>%s</td></tr>', |
@@ -6,12 +6,17 @@ |
||
6 | 6 | </div> |
7 | 7 | <div class="dump" id="<?= md5($name) ?>-variables" style="display: none;"> |
8 | 8 | <?php |
9 | - if (!is_array($content)) { |
|
9 | + if (!is_array($content)) |
|
10 | + { |
|
10 | 11 | echo is_scalar($value) ? htmlspecialchars($value) : json_encode($value, JSON_PRETTY_PRINT); |
11 | - } else { ?> |
|
12 | + } |
|
13 | + else |
|
14 | + { |
|
15 | +?> |
|
12 | 16 | <table> |
13 | 17 | <?php |
14 | - foreach ($content as $key => $value) { |
|
18 | + foreach ($content as $key => $value) |
|
19 | + { |
|
15 | 20 | // todo: values |
16 | 21 | echo sprintf( |
17 | 22 | '<tr><td class="name">%s</td><td>%s</td></tr>', |
@@ -4,23 +4,23 @@ discard block |
||
4 | 4 | * @var Throwable $exception |
5 | 5 | * @var \Spiral\Exceptions\ValueWrapper $valueWrapper |
6 | 6 | */ |
7 | -foreach ($stacktrace as $index => $trace) { |
|
8 | - if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])) { |
|
7 | +foreach ($stacktrace as $index => $trace){ |
|
8 | + if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])){ |
|
9 | 9 | $trace['file'] = $stacktrace[$index - 1]['file']; |
10 | 10 | $trace['line'] = $stacktrace[$index - 1]['line']; |
11 | 11 | } |
12 | 12 | |
13 | - if (!isset($stacktrace[$index + 1])) { |
|
13 | + if (!isset($stacktrace[$index + 1])){ |
|
14 | 14 | $trace['file'] = $exception->getFile(); |
15 | 15 | $trace['line'] = $exception->getLine(); |
16 | 16 | } |
17 | 17 | |
18 | - if (!isset($trace['function']) || !isset($trace['file'])) { |
|
18 | + if (!isset($trace['function']) || !isset($trace['file'])){ |
|
19 | 19 | continue; |
20 | 20 | } |
21 | 21 | |
22 | - $function = '<strong>' . $trace['function'] . '</strong>'; |
|
23 | - if (isset($trace['type']) && isset($trace['class'])) { |
|
22 | + $function = '<strong>'.$trace['function'].'</strong>'; |
|
23 | + if (isset($trace['type']) && isset($trace['class'])){ |
|
24 | 24 | $reflection = new ReflectionClass($trace['class']); |
25 | 25 | $function = sprintf( |
26 | 26 | '<span title="%s">%s</span>%s%s', |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | $args = []; |
35 | - if (isset($trace['args'])) { |
|
35 | + if (isset($trace['args'])){ |
|
36 | 36 | $args = $valueWrapper->wrap($trace['args']); |
37 | 37 | } ?> |
38 | 38 | <div class="call"> |
@@ -4,23 +4,28 @@ discard block |
||
4 | 4 | * @var Throwable $exception |
5 | 5 | * @var \Spiral\Exceptions\ValueWrapper $valueWrapper |
6 | 6 | */ |
7 | -foreach ($stacktrace as $index => $trace) { |
|
8 | - if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])) { |
|
7 | +foreach ($stacktrace as $index => $trace) |
|
8 | +{ |
|
9 | + if (empty($trace['file']) && isset($stacktrace[$index - 1]['file'])) |
|
10 | + { |
|
9 | 11 | $trace['file'] = $stacktrace[$index - 1]['file']; |
10 | 12 | $trace['line'] = $stacktrace[$index - 1]['line']; |
11 | 13 | } |
12 | 14 | |
13 | - if (!isset($stacktrace[$index + 1])) { |
|
15 | + if (!isset($stacktrace[$index + 1])) |
|
16 | + { |
|
14 | 17 | $trace['file'] = $exception->getFile(); |
15 | 18 | $trace['line'] = $exception->getLine(); |
16 | 19 | } |
17 | 20 | |
18 | - if (!isset($trace['function']) || !isset($trace['file'])) { |
|
21 | + if (!isset($trace['function']) || !isset($trace['file'])) |
|
22 | + { |
|
19 | 23 | continue; |
20 | 24 | } |
21 | 25 | |
22 | 26 | $function = '<strong>' . $trace['function'] . '</strong>'; |
23 | - if (isset($trace['type']) && isset($trace['class'])) { |
|
27 | + if (isset($trace['type']) && isset($trace['class'])) |
|
28 | + { |
|
24 | 29 | $reflection = new ReflectionClass($trace['class']); |
25 | 30 | $function = sprintf( |
26 | 31 | '<span title="%s">%s</span>%s%s', |
@@ -32,7 +37,8 @@ discard block |
||
32 | 37 | } |
33 | 38 | |
34 | 39 | $args = []; |
35 | - if (isset($trace['args'])) { |
|
40 | + if (isset($trace['args'])) |
|
41 | + { |
|
36 | 42 | $args = $valueWrapper->wrap($trace['args']); |
37 | 43 | } ?> |
38 | 44 | <div class="call"> |