Skip to content

Commit

Permalink
RouteList: $flags => $oneWay
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 21, 2024
1 parent 3059fcb commit f7419bc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Routing/RouteList.php
Expand Up @@ -19,7 +19,7 @@ class RouteList implements Router
{
protected ?self $parent;

/** @var array of [Router, flags] */
/** @var array<array{Router, int}> */
private array $list = [];

/** @var Router[][]|null */
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit f7419bc

Please sign in to comment.