@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | $generator = new ContextGenerator($views->getContext()); |
34 | 34 | |
35 | 35 | $contexts = $generator->generate(); |
36 | - if (empty($contexts)) { |
|
36 | + if (empty($contexts)){ |
|
37 | 37 | $contexts[] = $views->getContext(); |
38 | 38 | } |
39 | 39 | |
40 | - foreach ($contexts as $context) { |
|
41 | - foreach ($views->getEngines() as $engine) { |
|
42 | - if ($engine instanceof NativeEngine) { |
|
40 | + foreach ($contexts as $context){ |
|
41 | + foreach ($views->getEngines() as $engine){ |
|
42 | + if ($engine instanceof NativeEngine){ |
|
43 | 43 | // no need to compile |
44 | 44 | continue; |
45 | 45 | } |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | $this->describeContext($context) ?? "default" |
64 | 64 | ); |
65 | 65 | |
66 | - foreach ($engine->getLoader()->list() as $path) { |
|
66 | + foreach ($engine->getLoader()->list() as $path){ |
|
67 | 67 | $start = microtime(true); |
68 | - try { |
|
68 | + try{ |
|
69 | 69 | $engine->reset($path, $context); |
70 | 70 | $engine->compile($path, $context); |
71 | 71 | |
72 | - if ($this->isVerbose()) { |
|
72 | + if ($this->isVerbose()){ |
|
73 | 73 | $this->sprintf("<info>•</info> %s", $path); |
74 | 74 | } |
75 | - } catch (\Throwable $e) { |
|
75 | + }catch (\Throwable $e){ |
|
76 | 76 | $this->renderError($path, $e); |
77 | 77 | continue; |
78 | - } finally { |
|
78 | + }finally{ |
|
79 | 79 | $this->renderElapsed($start); |
80 | 80 | } |
81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $values = []; |
93 | 93 | |
94 | - foreach ($context->getDependencies() as $dependency) { |
|
94 | + foreach ($context->getDependencies() as $dependency){ |
|
95 | 95 | $values[] = sprintf( |
96 | 96 | "%s%s%s:%s%s%s", |
97 | 97 | Color::LIGHT_WHITE, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function renderError(string $path, \Throwable $e): void |
125 | 125 | { |
126 | - if (!$this->isVerbose()) { |
|
126 | + if (!$this->isVerbose()){ |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | */ |
141 | 141 | private function renderSuccess(string $lastPath = null): void |
142 | 142 | { |
143 | - if (!$this->isVerbose()) { |
|
143 | + if (!$this->isVerbose()){ |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | - if ($lastPath === null) { |
|
147 | + if ($lastPath === null){ |
|
148 | 148 | $this->writeln("• no views found"); |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function renderElapsed(float $start): void |
158 | 158 | { |
159 | - if (!$this->isVerbose()) { |
|
159 | + if (!$this->isVerbose()){ |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 |
@@ -33,13 +33,17 @@ discard block |
||
33 | 33 | $generator = new ContextGenerator($views->getContext()); |
34 | 34 | |
35 | 35 | $contexts = $generator->generate(); |
36 | - if (empty($contexts)) { |
|
36 | + if (empty($contexts)) |
|
37 | + { |
|
37 | 38 | $contexts[] = $views->getContext(); |
38 | 39 | } |
39 | 40 | |
40 | - foreach ($contexts as $context) { |
|
41 | - foreach ($views->getEngines() as $engine) { |
|
42 | - if ($engine instanceof NativeEngine) { |
|
41 | + foreach ($contexts as $context) |
|
42 | + { |
|
43 | + foreach ($views->getEngines() as $engine) |
|
44 | + { |
|
45 | + if ($engine instanceof NativeEngine) |
|
46 | + { |
|
43 | 47 | // no need to compile |
44 | 48 | continue; |
45 | 49 | } |
@@ -63,19 +67,26 @@ discard block |
||
63 | 67 | $this->describeContext($context) ?? "default" |
64 | 68 | ); |
65 | 69 | |
66 | - foreach ($engine->getLoader()->list() as $path) { |
|
70 | + foreach ($engine->getLoader()->list() as $path) |
|
71 | + { |
|
67 | 72 | $start = microtime(true); |
68 | - try { |
|
73 | + try |
|
74 | + { |
|
69 | 75 | $engine->reset($path, $context); |
70 | 76 | $engine->compile($path, $context); |
71 | 77 | |
72 | - if ($this->isVerbose()) { |
|
78 | + if ($this->isVerbose()) |
|
79 | + { |
|
73 | 80 | $this->sprintf("<info>•</info> %s", $path); |
74 | 81 | } |
75 | - } catch (\Throwable $e) { |
|
82 | + } |
|
83 | + catch (\Throwable $e) |
|
84 | + { |
|
76 | 85 | $this->renderError($path, $e); |
77 | 86 | continue; |
78 | - } finally { |
|
87 | + } |
|
88 | + finally |
|
89 | + { |
|
79 | 90 | $this->renderElapsed($start); |
80 | 91 | } |
81 | 92 | } |
@@ -91,7 +102,8 @@ discard block |
||
91 | 102 | { |
92 | 103 | $values = []; |
93 | 104 | |
94 | - foreach ($context->getDependencies() as $dependency) { |
|
105 | + foreach ($context->getDependencies() as $dependency) |
|
106 | + { |
|
95 | 107 | $values[] = sprintf( |
96 | 108 | "%s%s%s:%s%s%s", |
97 | 109 | Color::LIGHT_WHITE, |
@@ -123,7 +135,8 @@ discard block |
||
123 | 135 | */ |
124 | 136 | protected function renderError(string $path, \Throwable $e): void |
125 | 137 | { |
126 | - if (!$this->isVerbose()) { |
|
138 | + if (!$this->isVerbose()) |
|
139 | + { |
|
127 | 140 | return; |
128 | 141 | } |
129 | 142 | |
@@ -140,11 +153,13 @@ discard block |
||
140 | 153 | */ |
141 | 154 | private function renderSuccess(string $lastPath = null): void |
142 | 155 | { |
143 | - if (!$this->isVerbose()) { |
|
156 | + if (!$this->isVerbose()) |
|
157 | + { |
|
144 | 158 | return; |
145 | 159 | } |
146 | 160 | |
147 | - if ($lastPath === null) { |
|
161 | + if ($lastPath === null) |
|
162 | + { |
|
148 | 163 | $this->writeln("• no views found"); |
149 | 164 | } |
150 | 165 | |
@@ -156,7 +171,8 @@ discard block |
||
156 | 171 | */ |
157 | 172 | private function renderElapsed(float $start): void |
158 | 173 | { |
159 | - if (!$this->isVerbose()) { |
|
174 | + if (!$this->isVerbose()) |
|
175 | + { |
|
160 | 176 | return; |
161 | 177 | } |
162 | 178 |