@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $requestUri = $request->getUri(); |
| 61 | 61 | $response = $handler->handle($request); |
| 62 | - $requestPath = \preg_replace($prefixRegex, $requestUri->getPath()[-1], $requestUri->getPath()); |
|
| 62 | + $requestPath = \preg_replace($prefixRegex, $requestUri->getPath()[- 1], $requestUri->getPath()); |
|
| 63 | 63 | |
| 64 | 64 | // Determine the response code should keep HTTP request method ... |
| 65 | 65 | $statusCode = $this->keepRequestMethod ? ($this->permanent ? 308 : 307) : ($this->permanent ? 301 : 302); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | $route = $request->getAttribute(Route::class); |
| 72 | 72 | |
| 73 | 73 | if ($route instanceof Route) { |
| 74 | - $routeEndTail = Route::URL_PREFIX_SLASHES[$route->get('path')[-1]] ?? null; |
|
| 75 | - $requestEndTail = Route::URL_PREFIX_SLASHES[$requestPath[-1]] ?? null; |
|
| 74 | + $routeEndTail = Route::URL_PREFIX_SLASHES[$route->get('path')[- 1]] ?? null; |
|
| 75 | + $requestEndTail = Route::URL_PREFIX_SLASHES[$requestPath[- 1]] ?? null; |
|
| 76 | 76 | |
| 77 | 77 | if ($routeEndTail === $requestEndTail) { |
| 78 | 78 | return $response; |
@@ -206,7 +206,7 @@ |
||
| 206 | 206 | public function namespace(string $namespace): self |
| 207 | 207 | { |
| 208 | 208 | if ('' !== $namespace) { |
| 209 | - if ('\\' === $namespace[-1]) { |
|
| 209 | + if ('\\' === $namespace[- 1]) { |
|
| 210 | 210 | throw new InvalidControllerException(\sprintf('Namespace "%s" provided for routes must not end with a "\\".', $namespace)); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $routePath = \ltrim($route->get('path'), '/'); |
| 102 | 102 | |
| 103 | 103 | // Strip supported browser prefix of $routePath ... |
| 104 | - if (!empty($routePath) && isset(Route::URL_PREFIX_SLASHES[$routePath[-1]])) { |
|
| 104 | + if (!empty($routePath) && isset(Route::URL_PREFIX_SLASHES[$routePath[- 1]])) { |
|
| 105 | 105 | $routePath = \substr($routePath, 0, -1); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $regex = \substr($regex, 2); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if ('$' === $regex[-1]) { |
|
| 217 | + if ('$' === $regex[- 1]) { |
|
| 218 | 218 | $regex = \substr($regex, 0, -1); |
| 219 | 219 | } elseif (\strlen($regex) - 2 === \strpos($regex, '\\z')) { |
| 220 | 220 | $regex = \substr($regex, 0, -2); |
@@ -215,12 +215,12 @@ |
||
| 215 | 215 | return $uri; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if (isset(Route::URL_PREFIX_SLASHES[$prefix[-1]], Route::URL_PREFIX_SLASHES[$uri[0]])) { |
|
| 218 | + if (isset(Route::URL_PREFIX_SLASHES[$prefix[- 1]], Route::URL_PREFIX_SLASHES[$uri[0]])) { |
|
| 219 | 219 | return $prefix . \ltrim($uri, \implode('', Route::URL_PREFIX_SLASHES)); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // browser supported slashes ... |
| 223 | - $slashExist = Route::URL_PREFIX_SLASHES[$prefix[-1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
| 223 | + $slashExist = Route::URL_PREFIX_SLASHES[$prefix[- 1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
| 224 | 224 | |
| 225 | 225 | if (null === $slashExist) { |
| 226 | 226 | $prefix .= '/'; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $route->end($this); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - ++$this->countRoutes; |
|
| 103 | + ++ $this->countRoutes; |
|
| 104 | 104 | |
| 105 | 105 | return $route; |
| 106 | 106 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $routes->staticRouteMap[$pathRegex] = [$routeId, $methods, !empty($hostsRegex) ? '#^(?|' . \implode('|', $hostsRegex) . ')$#i' : null]; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - ++$routes->countRoutes; |
|
| 156 | + ++ $routes->countRoutes; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | private function generateRouteName(Route $route, array $unnamedRoutes): string |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $name = $route->generateRouteName(''); |
| 163 | 163 | |
| 164 | 164 | if (isset($unnamedRoutes[$name])) { |
| 165 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
| 165 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
| 166 | 166 | } else { |
| 167 | 167 | $unnamedRoutes[$name] = 0; |
| 168 | 168 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $requestPath = $uri->getPath(); |
| 90 | 90 | |
| 91 | - if ('/' !== $requestPath && isset(Route::URL_PREFIX_SLASHES[$requestPath[-1]])) { |
|
| 91 | + if ('/' !== $requestPath && isset(Route::URL_PREFIX_SLASHES[$requestPath[- 1]])) { |
|
| 92 | 92 | $uri = $uri->withPath($requestPath = \substr($requestPath, 0, -1)); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | foreach ($variables as $key => $value) { |
| 141 | 141 | $route->argument($key, $matches[$matchVar] ?? $value); |
| 142 | 142 | |
| 143 | - ++$matchVar; |
|
| 143 | + ++ $matchVar; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | return $this->matchRoute($route, $uri); |