@@ -80,9 +80,12 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function serve() |
82 | 82 | { |
83 | - foreach ($this->dispatchers as $dispatcher) { |
|
84 | - if ($dispatcher->canServe()) { |
|
85 | - ContainerScope::runScope($this->container, function () use ($dispatcher) { |
|
83 | + foreach ($this->dispatchers as $dispatcher) |
|
84 | + { |
|
85 | + if ($dispatcher->canServe()) |
|
86 | + { |
|
87 | + ContainerScope::runScope($this->container, function () use ($dispatcher) |
|
88 | + { |
|
86 | 89 | $dispatcher->serve(); |
87 | 90 | }); |
88 | 91 | return; |
@@ -105,11 +108,13 @@ discard block |
||
105 | 108 | */ |
106 | 109 | protected function mapDirectories(array $directories): array |
107 | 110 | { |
108 | - if (!isset($directories['root'])) { |
|
111 | + if (!isset($directories['root'])) |
|
112 | + { |
|
109 | 113 | throw new FrameworkException("Missing required directory `root`."); |
110 | 114 | } |
111 | 115 | |
112 | - if (!isset($directories['app'])) { |
|
116 | + if (!isset($directories['app'])) |
|
117 | + { |
|
113 | 118 | $directories['app'] = $directories['root'] . '/app/'; |
114 | 119 | } |
115 | 120 | |
@@ -152,7 +157,8 @@ discard block |
||
152 | 157 | EnvironmentInterface $environment = null, |
153 | 158 | bool $handleErrors = true |
154 | 159 | ): self { |
155 | - if ($handleErrors) { |
|
160 | + if ($handleErrors) |
|
161 | + { |
|
156 | 162 | ExceptionHandler::register(); |
157 | 163 | } |
158 | 164 | |
@@ -162,11 +168,15 @@ discard block |
||
162 | 168 | $environment ?? new Environment() |
163 | 169 | ); |
164 | 170 | |
165 | - try { |
|
166 | - ContainerScope::runScope($core->container, function () use ($core) { |
|
171 | + try |
|
172 | + { |
|
173 | + ContainerScope::runScope($core->container, function () use ($core) |
|
174 | + { |
|
167 | 175 | $core->bootload()->bootstrap(); |
168 | 176 | }); |
169 | - } catch (\Throwable $e) { |
|
177 | + } |
|
178 | + catch (\Throwable $e) |
|
179 | + { |
|
170 | 180 | ExceptionHandler::handleException($e); |
171 | 181 | } |
172 | 182 |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getID(): string |
41 | 41 | { |
42 | - if (empty($this->id)) { |
|
42 | + if (empty($this->id)) |
|
43 | + { |
|
43 | 44 | $this->id = md5(serialize($this->values)); |
44 | 45 | } |
45 | 46 | |
@@ -62,7 +63,8 @@ discard block |
||
62 | 63 | */ |
63 | 64 | public function get(string $name, $default = null) |
64 | 65 | { |
65 | - if (isset($this->values[$name])) { |
|
66 | + if (isset($this->values[$name])) |
|
67 | + { |
|
66 | 68 | return $this->normalize($this->values[$name]); |
67 | 69 | } |
68 | 70 | |
@@ -75,12 +77,14 @@ discard block |
||
75 | 77 | */ |
76 | 78 | protected function normalize($value): ?string |
77 | 79 | { |
78 | - if (!is_string($value)) { |
|
80 | + if (!is_string($value)) |
|
81 | + { |
|
79 | 82 | return $value; |
80 | 83 | } |
81 | 84 | |
82 | 85 | $alias = strtolower($value); |
83 | - if (isset(self::VALUE_MAP[$alias])) { |
|
86 | + if (isset(self::VALUE_MAP[$alias])) |
|
87 | + { |
|
84 | 88 | return self::VALUE_MAP[$alias]; |
85 | 89 | } |
86 | 90 |