From f7419bc147164106cb03b3d331c85aff6cb81fc3 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 11 Dec 2023 12:23:07 +0100 Subject: [PATCH] RouteList: $flags => $oneWay --- src/Routing/RouteList.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Routing/RouteList.php b/src/Routing/RouteList.php index f53dc83..4156175 100644 --- a/src/Routing/RouteList.php +++ b/src/Routing/RouteList.php @@ -19,7 +19,7 @@ class RouteList implements Router { protected ?self $parent; - /** @var array of [Router, flags] */ + /** @var array */ private array $list = []; /** @var Router[][]|null */ @@ -136,8 +136,8 @@ public function warmupCache(): void // find best key $candidates = []; $routers = []; - foreach ($this->list as [$router, $flags]) { - if ($flags & self::ONE_WAY) { + foreach ($this->list as [$router, $oneWay]) { + if ($oneWay) { continue; } elseif ($router instanceof self) { $router->warmupCache(); @@ -187,9 +187,9 @@ public function warmupCache(): void /** * Adds a router. */ - public function add(Router $router, int $flags = 0): static + public function add(Router $router, int $oneWay = 0): static { - $this->list[] = [$router, $flags]; + $this->list[] = [$router, $oneWay]; $this->ranks = null; return $this; } @@ -198,9 +198,9 @@ public function add(Router $router, int $flags = 0): static /** * Prepends a router. */ - public function prepend(Router $router, int $flags = 0): void + public function prepend(Router $router, int $oneWay = 0): void { - array_splice($this->list, 0, 0, [[$router, $flags]]); + array_splice($this->list, 0, 0, [[$router, $oneWay]]); $this->ranks = null; } @@ -225,9 +225,9 @@ protected function modify(int $index, ?Router $router): void * @param array $metadata default values or metadata * @return static */ - public function addRoute(string $mask, array $metadata = [], int $flags = 0) + public function addRoute(string $mask, array $metadata = [], int $oneWay = 0) { - $this->add(new Route($mask, $metadata), $flags); + $this->add(new Route($mask, $metadata), $oneWay); return $this; }