diff --git a/src/RouterCollector.php b/src/RouterCollector.php index 68eca25..01e8011 100644 --- a/src/RouterCollector.php +++ b/src/RouterCollector.php @@ -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) {