@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getRenderCallback(string $uri, array $context = []): callable |
59 | 59 | { |
60 | - if (! is_readable($uri)) { |
|
60 | + if ( ! is_readable($uri)) { |
|
61 | 61 | throw new FailedToLoadView( |
62 | 62 | sprintf( |
63 | 63 | _('The View URI "%1$s" is not accessible or readable.'), |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ); |
67 | 67 | } |
68 | 68 | |
69 | - $closure = function () use ($uri, $context) { |
|
69 | + $closure = function() use ($uri, $context) { |
|
70 | 70 | |
71 | 71 | // Save current buffering level so we can backtrack in case of an error. |
72 | 72 | // This is needed because the view itself might also add an unknown number of output buffering levels. |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function hasLocation(Location $location): bool |
55 | 55 | { |
56 | - return $this->exists(function ($key, $element) use ($location) { |
|
56 | + return $this->exists(function($key, $element) use ($location) { |
|
57 | 57 | return $location == $element; |
58 | 58 | }); |
59 | 59 | } |
@@ -50,6 +50,6 @@ |
||
50 | 50 | */ |
51 | 51 | public function getRenderCallback(string $uri, array $context = []): callable |
52 | 52 | { |
53 | - return function () { return ''; }; |
|
53 | + return function() { return ''; }; |
|
54 | 54 | } |
55 | 55 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public static function hasExtension(string $uri, string $extension): bool |
36 | 36 | { |
37 | - $extension = '.' . ltrim($extension, '.'); |
|
37 | + $extension = '.'.ltrim($extension, '.'); |
|
38 | 38 | $uriLength = mb_strlen($uri); |
39 | 39 | $extensionLength = mb_strlen($extension); |
40 | 40 | if ($extensionLength > $uriLength) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function initializeFindables($arguments = null): Findables |
158 | 158 | { |
159 | - return $this->findables->map(function ($findable) use ($arguments) { |
|
159 | + return $this->findables->map(function($findable) use ($arguments) { |
|
160 | 160 | return $this->initializeFindable($findable, $arguments); |
161 | 161 | }); |
162 | 162 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $findable = $this->instantiateFindableFromCallable($findable, $arguments); |
199 | 199 | } |
200 | 200 | |
201 | - if (! $findable instanceof Findable) { |
|
201 | + if ( ! $findable instanceof Findable) { |
|
202 | 202 | throw new FailedToInstantiateFindable( |
203 | 203 | sprintf( |
204 | 204 | _('Could not instantiate Findable "%s".'), |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | protected function instantiateFindableFromString(string $string, $arguments = []): Findable |
224 | 224 | { |
225 | - return new $string(...(array)$arguments); |
|
225 | + return new $string(...(array) $arguments); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -237,6 +237,6 @@ discard block |
||
237 | 237 | */ |
238 | 238 | protected function instantiateFindableFromCallable(callable $callable, $arguments = []): Findable |
239 | 239 | { |
240 | - return $callable(...(array)$arguments); |
|
240 | + return $callable(...(array) $arguments); |
|
241 | 241 | } |
242 | 242 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | * @param string $behavior Behavior to use for adapting the context. |
83 | 83 | * @return View |
84 | 84 | */ |
85 | - public function addToContext( string $key, $value, string $behavior ): View; |
|
85 | + public function addToContext(string $key, $value, string $behavior): View; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Associate a view builder with this view. |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | * @param string $behavior Behavior to use for adapting the context. |
168 | 168 | * @return View |
169 | 169 | */ |
170 | - public function addToContext( string $key, $value, string $behavior ): View |
|
170 | + public function addToContext(string $key, $value, string $behavior): View |
|
171 | 171 | { |
172 | 172 | switch ($behavior) { |
173 | 173 | case View::REPLACE: |
174 | 174 | $this->_context_[$key] = $value; |
175 | 175 | return $this; |
176 | 176 | case View::MERGE: |
177 | - if(array_key_exists($key, $this->_context_)) { |
|
177 | + if (array_key_exists($key, $this->_context_)) { |
|
178 | 178 | $this->_context_ = array_merge_recursive($this->_context_, [$key => $value]); |
179 | 179 | return $this; |
180 | 180 | } |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | $this->_context_[$key] = $value; |
188 | 188 | return $this; |
189 | 189 | case View::REPLACE_ONLY: |
190 | - if (! array_key_exists($key, $this->_context_)) { |
|
190 | + if ( ! array_key_exists($key, $this->_context_)) { |
|
191 | 191 | return $this; |
192 | 192 | } |
193 | 193 | $this->_context_[$key] = $value; |
194 | 194 | return $this; |
195 | 195 | case View::MERGE_ONLY: |
196 | - if (! array_key_exists($key, $this->_context_)) { |
|
196 | + if ( ! array_key_exists($key, $this->_context_)) { |
|
197 | 197 | return $this; |
198 | 198 | } |
199 | 199 | $this->_context_ = array_merge_recursive($this->_context_, [$key => $value]); |
@@ -91,7 +91,7 @@ |
||
91 | 91 | * @param string $behavior Behavior to use for adapting the context. |
92 | 92 | * @return View |
93 | 93 | */ |
94 | - public function addToContext( string $key, $value, string $behavior ): View { |
|
94 | + public function addToContext(string $key, $value, string $behavior): View { |
|
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function create(string $view, $type = null): View |
111 | 111 | { |
112 | - if (!array_key_exists($view, $this->viewPathCache)) { |
|
112 | + if ( ! array_key_exists($view, $this->viewPathCache)) { |
|
113 | 113 | $uri = $this->scanLocations([$view]); |
114 | 114 | $engine = $uri ? $this->getEngine($uri) : false; |
115 | 115 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $this->viewPathCache[$view]['uri'] = $uri; |
118 | 118 | $this->viewPathCache[$view]['engine'] = $engine; |
119 | 119 | |
120 | - if ($type===null) { |
|
120 | + if ($type === null) { |
|
121 | 121 | $this->viewPathCache[$view]['view'] = $uri |
122 | 122 | ? $this->getView($uri, $engine) |
123 | 123 | : false; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | - if (!$uri || !$engine) { |
|
131 | + if ( ! $uri || ! $engine) { |
|
132 | 132 | return $this->getViewFinder()->getNullObject(); |
133 | 133 | } |
134 | 134 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | if (null === $type) { |
171 | 171 | $view = $this->getViewFinder()->find([$uri], $engine); |
172 | - return $view->setBuilder( $this ); |
|
172 | + return $view->setBuilder($this); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return $this->resolveType($type, $uri, $engine); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | { |
213 | 213 | $this->locations->add($location); |
214 | 214 | |
215 | - unset( $this->viewPathCache ); |
|
215 | + unset($this->viewPathCache); |
|
216 | 216 | $this->viewPathCache = []; |
217 | 217 | |
218 | 218 | return $this; |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function scanLocations(array $criteria) |
243 | 243 | { |
244 | - $uris = $this->locations->map(function ($location) use ($criteria) { |
|
244 | + $uris = $this->locations->map(function($location) use ($criteria) { |
|
245 | 245 | /** @var Location $location */ |
246 | 246 | return $location->getURI($criteria); |
247 | - })->filter(function ($uri) { |
|
247 | + })->filter(function($uri) { |
|
248 | 248 | return false !== $uri; |
249 | 249 | }); |
250 | 250 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $type = $type($uri, $engine, $this); |
305 | 305 | } |
306 | 306 | |
307 | - if (! $type instanceof View) { |
|
307 | + if ( ! $type instanceof View) { |
|
308 | 308 | throw new FailedToInstantiateView( |
309 | 309 | sprintf( |
310 | 310 | _('Could not instantiate view "%s".'), |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | protected function getConfig($config = []): ConfigInterface |
329 | 329 | { |
330 | - $defaults = ConfigFactory::create(dirname(__DIR__, 2) . '/config/defaults.php', $config); |
|
330 | + $defaults = ConfigFactory::create(dirname(__DIR__, 2).'/config/defaults.php', $config); |
|
331 | 331 | $config = $config |
332 | 332 | ? ConfigFactory::createFromArray(array_merge_recursive($defaults->getArrayCopy(), $config->getArrayCopy())) |
333 | 333 | : $defaults; |