Skip to content

Commit f60ab97

Browse files
committed
refactor: remove comments that restate the code in checkRoutes()
The dropped comments only repeated what the following lines do. The ones that explain why the code works this way, including the metacharacter list and the trailing-LF fallback, are kept.
1 parent 1dec495 commit f60ab97

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

‎system/Router/Router.php‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ protected function checkRoutes(string $uri): bool
440440
? $uri
441441
: trim($uri, '/ ');
442442

443-
// Loop through the route array looking for wildcards
444443
foreach ($routes as $routeKey => $handler) {
445444
$routeKey = $routeKey === '/'
446445
? $routeKey
@@ -463,7 +462,6 @@ protected function checkRoutes(string $uri): bool
463462

464463
$matches = [$uri];
465464
} else {
466-
// Are we dealing with a locale?
467465
if (str_contains($routeKey, '{locale}')) {
468466
$routeKey = str_replace('{locale}', '[^/]+', $routeKey);
469467
}
@@ -493,7 +491,6 @@ protected function checkRoutes(string $uri): bool
493491
unset($matched);
494492
}
495493

496-
// Is this route supposed to redirect to another?
497494
if ($this->collection->isRedirect($matchedKey)) {
498495
// replacing matched route groups with references: post/([0-9]+) -> post/$1
499496
$redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function (): string {
@@ -512,13 +509,9 @@ protected function checkRoutes(string $uri): bool
512509
);
513510
}
514511

515-
// Are we using Closures? If so, then we need
516-
// to collect the params into an array
517-
// so it can be passed to the controller method later.
518512
if (! is_string($handler) && is_callable($handler)) {
519513
$this->controller = $handler;
520514

521-
// Remove the original string from the matches array
522515
array_shift($matches);
523516

524517
$this->params = $matches;
@@ -535,19 +528,16 @@ protected function checkRoutes(string $uri): bool
535528
$methodAndParams = '';
536529
}
537530

538-
// Checks `/` in controller name
539531
if (str_contains($controller, '/')) {
540532
throw RouterException::forInvalidControllerName($handler);
541533
}
542534

543535
if (str_contains($handler, '$') && str_contains($routeKey, '(')) {
544-
// Checks dynamic controller
545536
if (str_contains($controller, '$')) {
546537
throw RouterException::forDynamicController($handler);
547538
}
548539

549540
if (config(Routing::class)->multipleSegmentsOneParam === false) {
550-
// Using back-references
551541
$segments = explode('/', preg_replace('#\A' . $routeKey . '\z#u', $handler, $uri));
552542
} else {
553543
if (str_contains($methodAndParams, '/')) {

0 commit comments

Comments
 (0)