Skip to content

Commit

Permalink
Merge pull request #1070 from iAvenger01/feature/route
Browse files Browse the repository at this point in the history
[spiral/router] Update Route list command for customization route class
  • Loading branch information
butschster committed Jan 26, 2024
2 parents 3db2bb2 + 295620c commit 2c780fc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Framework/Command/Router/ListCommand.php
Expand Up @@ -8,7 +8,7 @@
use Spiral\Console\Command;
use Spiral\Core\Attribute\Singleton;
use Spiral\Router\GroupRegistry;
use Spiral\Router\Route;
use Spiral\Router\RouteInterface;
use Spiral\Router\RouterInterface;
use Spiral\Router\Target\Action;
use Spiral\Router\Target\Controller;
Expand All @@ -29,7 +29,7 @@ public function perform(RouterInterface $router, GroupRegistry $registry, Kernel
$grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:', 'Group:']);

foreach ($router->getRoutes() as $name => $route) {
if ($route instanceof Route) {
if ($route instanceof RouteInterface) {
$grid->addRow(
[
$name,
Expand Down Expand Up @@ -62,9 +62,9 @@ private function getRouteGroups(GroupRegistry $registry, string $routeName): arr
return $groups;
}

private function getVerbs(Route $route): string
private function getVerbs(RouteInterface $route): string
{
if ($route->getVerbs() === Route::VERBS) {
if ($route->getVerbs() === RouteInterface::VERBS) {
return '*';
}

Expand All @@ -82,7 +82,7 @@ private function getVerbs(Route $route): string
return \implode(', ', $result);
}

private function getPattern(Route $route): string
private function getPattern(RouteInterface $route): string
{
$pattern = $this->getValue($route->getUriHandler(), 'pattern');
$prefix = $this->getValue($route->getUriHandler(), 'prefix');
Expand All @@ -106,7 +106,7 @@ private function getPattern(Route $route): string
*
* @throws \ReflectionException
*/
private function getTarget(Route $route, KernelInterface $kernel): string
private function getTarget(RouteInterface $route, KernelInterface $kernel): string
{
$target = $this->getValue($route, 'target');
switch (true) {
Expand Down

0 comments on commit 2c780fc

Please sign in to comment.