@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | array $directories, |
| 117 | 117 | bool $handleErrors = true |
| 118 | 118 | ): self { |
| 119 | - if ($handleErrors) { |
|
| 119 | + if ($handleErrors){ |
|
| 120 | 120 | ExceptionHandler::register(); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function run(?EnvironmentInterface $environment = null): ?self |
| 138 | 138 | { |
| 139 | - try { |
|
| 139 | + try{ |
|
| 140 | 140 | // will protect any against env overwrite action |
| 141 | 141 | $this->container->runScope( |
| 142 | 142 | [EnvironmentInterface::class => $environment ?? new Environment()], |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $this->bootstrap(); |
| 146 | 146 | } |
| 147 | 147 | ); |
| 148 | - } catch (\Throwable $e) { |
|
| 148 | + }catch (\Throwable $e){ |
|
| 149 | 149 | ExceptionHandler::handleException($e); |
| 150 | 150 | |
| 151 | 151 | return null; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function starting(Closure ...$callbacks): void |
| 167 | 167 | { |
| 168 | - foreach ($callbacks as $callback) { |
|
| 168 | + foreach ($callbacks as $callback){ |
|
| 169 | 169 | $this->startingCallbacks[] = $callback; |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function started(Closure ...$callbacks): void |
| 183 | 183 | { |
| 184 | - foreach ($callbacks as $callback) { |
|
| 184 | + foreach ($callbacks as $callback){ |
|
| 185 | 185 | $this->startedCallbacks[] = $callback; |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function serve() |
| 207 | 207 | { |
| 208 | - foreach ($this->dispatchers as $dispatcher) { |
|
| 209 | - if ($dispatcher->canServe()) { |
|
| 208 | + foreach ($this->dispatchers as $dispatcher){ |
|
| 209 | + if ($dispatcher->canServe()){ |
|
| 210 | 210 | return $this->container->runScope( |
| 211 | 211 | [DispatcherInterface::class => $dispatcher], |
| 212 | 212 | [$dispatcher, 'serve'] |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private function fireCallbacks(array &$callbacks): void |
| 262 | 262 | { |
| 263 | - if ($callbacks === []) { |
|
| 263 | + if ($callbacks === []){ |
|
| 264 | 264 | return; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - do { |
|
| 267 | + do{ |
|
| 268 | 268 | \current($callbacks)($this); |
| 269 | - } while (\next($callbacks)); |
|
| 269 | + }while (\next($callbacks)); |
|
| 270 | 270 | |
| 271 | 271 | $callbacks = []; |
| 272 | 272 | } |
@@ -116,7 +116,8 @@ discard block |
||
| 116 | 116 | array $directories, |
| 117 | 117 | bool $handleErrors = true |
| 118 | 118 | ): self { |
| 119 | - if ($handleErrors) { |
|
| 119 | + if ($handleErrors) |
|
| 120 | + { |
|
| 120 | 121 | ExceptionHandler::register(); |
| 121 | 122 | } |
| 122 | 123 | |
@@ -136,7 +137,8 @@ discard block |
||
| 136 | 137 | */ |
| 137 | 138 | public function run(?EnvironmentInterface $environment = null): ?self |
| 138 | 139 | { |
| 139 | - try { |
|
| 140 | + try |
|
| 141 | + { |
|
| 140 | 142 | // will protect any against env overwrite action |
| 141 | 143 | $this->container->runScope( |
| 142 | 144 | [EnvironmentInterface::class => $environment ?? new Environment()], |
@@ -145,7 +147,9 @@ discard block |
||
| 145 | 147 | $this->bootstrap(); |
| 146 | 148 | } |
| 147 | 149 | ); |
| 148 | - } catch (\Throwable $e) { |
|
| 150 | + } |
|
| 151 | + catch (\Throwable $e) |
|
| 152 | + { |
|
| 149 | 153 | ExceptionHandler::handleException($e); |
| 150 | 154 | |
| 151 | 155 | return null; |
@@ -165,7 +169,8 @@ discard block |
||
| 165 | 169 | */ |
| 166 | 170 | public function starting(Closure ...$callbacks): void |
| 167 | 171 | { |
| 168 | - foreach ($callbacks as $callback) { |
|
| 172 | + foreach ($callbacks as $callback) |
|
| 173 | + { |
|
| 169 | 174 | $this->startingCallbacks[] = $callback; |
| 170 | 175 | } |
| 171 | 176 | } |
@@ -181,7 +186,8 @@ discard block |
||
| 181 | 186 | */ |
| 182 | 187 | public function started(Closure ...$callbacks): void |
| 183 | 188 | { |
| 184 | - foreach ($callbacks as $callback) { |
|
| 189 | + foreach ($callbacks as $callback) |
|
| 190 | + { |
|
| 185 | 191 | $this->startedCallbacks[] = $callback; |
| 186 | 192 | } |
| 187 | 193 | } |
@@ -205,8 +211,10 @@ discard block |
||
| 205 | 211 | */ |
| 206 | 212 | public function serve() |
| 207 | 213 | { |
| 208 | - foreach ($this->dispatchers as $dispatcher) { |
|
| 209 | - if ($dispatcher->canServe()) { |
|
| 214 | + foreach ($this->dispatchers as $dispatcher) |
|
| 215 | + { |
|
| 216 | + if ($dispatcher->canServe()) |
|
| 217 | + { |
|
| 210 | 218 | return $this->container->runScope( |
| 211 | 219 | [DispatcherInterface::class => $dispatcher], |
| 212 | 220 | [$dispatcher, 'serve'] |
@@ -260,11 +268,13 @@ discard block |
||
| 260 | 268 | */ |
| 261 | 269 | private function fireCallbacks(array &$callbacks): void |
| 262 | 270 | { |
| 263 | - if ($callbacks === []) { |
|
| 271 | + if ($callbacks === []) |
|
| 272 | + { |
|
| 264 | 273 | return; |
| 265 | 274 | } |
| 266 | 275 | |
| 267 | - do { |
|
| 276 | + do |
|
| 277 | + { |
|
| 268 | 278 | \current($callbacks)($this); |
| 269 | 279 | } while (\next($callbacks)); |
| 270 | 280 | |