This commit is contained in:
2023-04-19 23:11:54 +08:00
parent e892f0f35d
commit 451441e6bd
+18
View File
@@ -27,6 +27,9 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
private array $_item = [];
private array $dump = [];
public array $groupTack = [];
@@ -42,6 +45,15 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
}
/**
* @return array
*/
public function getDump(): array
{
return $this->dump;
}
/**
* @return Traversable
*/
@@ -71,6 +83,12 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
if ($value instanceof RequestMethod) {
$value = $value->getString();
}
if (is_array($closure)) {
$closure[0] = is_object($closure[0]) ? get_class($closure[0]) : $closure;
} else if (is_string($closure)) {
$closure = explode('@', $closure);
}
$this->dump[$value][$route] = $closure instanceof Closure ? 'Closure' : $closure;
$this->register($route, $value, $handler);
}
} catch (Throwable $throwable) {