@@ -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 | } |
@@ -124,18 +124,18 @@ 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) { |
| 133 | - $criterion = substr($criterion,0,-strlen(".{$extension}")); |
|
| 133 | + $criterion = substr($criterion, 0, -strlen(".{$extension}")); |
|
| 134 | 134 | } |
| 135 | 135 | } else { |
| 136 | 136 | $extension = URIHelper::containsExtension($criterion); |
| 137 | - if (!empty($extension)) { |
|
| 138 | - $criterion = substr($criterion,0,-strlen(".{$extension}")); |
|
| 137 | + if ( ! empty($extension)) { |
|
| 138 | + $criterion = substr($criterion, 0, -strlen(".{$extension}")); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
@@ -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 | /** |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | $extensions = new Extensions(['']); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if (! $extensions instanceof Extensions) { |
|
| 180 | - $extensions = new Extensions((array)$extensions); |
|
| 179 | + if ( ! $extensions instanceof Extensions) { |
|
| 180 | + $extensions = new Extensions((array) $extensions); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return $extensions; |
@@ -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 | |