@@ -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 | } |
@@ -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 | } |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $names = []; |
| 126 | 126 | |
| 127 | - $names[] = array_map(function ($criterion) use ($extension) { |
|
| 127 | + $names[] = array_map(function($criterion) use ($extension) { |
|
| 128 | 128 | $uriExtension = URIHelper::containsExtension($criterion); |
| 129 | - if (! empty($extension)) { |
|
| 129 | + if ( ! empty($extension)) { |
|
| 130 | 130 | $extension = ltrim($extension, '.'); |
| 131 | 131 | |
| 132 | 132 | if ($uriExtension === $extension) { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } else { |
| 136 | 136 | $extension = URIHelper::containsExtension($criterion); |
| 137 | - if (!empty($extension)) { |
|
| 137 | + if ( ! empty($extension)) { |
|
| 138 | 138 | $criterion = substr($criterion, 0, -strlen(".{$extension}")); |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | : "^{$criterion}\.{$extension}$"; |
| 147 | 147 | }, $criteria)[0]; |
| 148 | 148 | |
| 149 | - return chr(1) . implode('|', array_unique($names)) . chr(1); |
|
| 149 | + return chr(1).implode('|', array_unique($names)).chr(1); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return $this->path; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - return rtrim($this->path, '/') . '/' . ltrim($relativePath, '/'); |
|
| 167 | + return rtrim($this->path, '/').'/'.ltrim($relativePath, '/'); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | $extensions = new Extensions(['']); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if (! $extensions instanceof Extensions) { |
|
| 206 | - $extensions = new Extensions((array)$extensions); |
|
| 205 | + if ( ! $extensions instanceof Extensions) { |
|
| 206 | + $extensions = new Extensions((array) $extensions); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | return $extensions; |
@@ -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 | |
@@ -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'); |
|
| 330 | + $defaults = ConfigFactory::create(dirname(__DIR__, 2).'/config/defaults.php'); |
|
| 331 | 331 | $config = $config |
| 332 | 332 | ? ConfigFactory::createFromArray(array_merge_recursive($defaults->getArrayCopy(), $config->getArrayCopy())) |
| 333 | 333 | : $defaults; |
@@ -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]); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function __call($method, $arguments) |
| 251 | 251 | { |
| 252 | - if (! property_exists($this, $method) |
|
| 252 | + if ( ! property_exists($this, $method) |
|
| 253 | 253 | || ! is_callable($this->$method)) { |
| 254 | 254 | trigger_error( |
| 255 | 255 | "Call to undefined method {$method} on a view.", |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function getRenderCallback(string $uri, array $context = []): callable |
| 52 | 52 | { |
| 53 | - return function () { |
|
| 53 | + return function() { |
|
| 54 | 54 | return ''; |
| 55 | 55 | }; |
| 56 | 56 | } |