src/Command/RoutesCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (false === is_file('composer.json')) {
            throw new Exception('Commands must be run from root of project.');
        }

        try {
            $app  = new App();
            require 'src/routes.php';
            $routes = $app->getContainer()->get('router')->getRoutes();
            foreach ($routes as $route) {
                foreach ($route->getMethods() as $method) {
                    $name     = str_pad($route->getName(), 10, ' ', STR_PAD_LEFT);
                    $method   = str_pad($method, 8, ' ', STR_PAD_RIGHT);
                    $routeStr = str_pad($route->getPattern(), 15, ' ', STR_PAD_RIGHT);
                    $resolvesTo = (is_string($route->getCallable()) ? $route->getCallable() : '');
                    $output->writeln('<info>'.$name.$method.$routeStr.$resolvesTo.'</info>');
                }
            }
        } catch (Exception $e) {
            $output->writeln($e->getMessage());
        }
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (false === is_file('composer.json')) {
            throw new Exception('Commands must be run from root of project.');
        }

        try {
            $app  = new App();
            require 'src/routes.php';
            $routes = $app->getContainer()->get('router')->getRoutes();
            foreach ($routes as $route) {
                foreach ($route->getMethods() as $method) {
                    $name     = str_pad($route->getName(), 10, ' ', STR_PAD_LEFT);
                    $method   = str_pad($method, 8, ' ', STR_PAD_RIGHT);
                    $routeStr = str_pad($route->getPattern(), 15, ' ', STR_PAD_RIGHT);
                    $resolvesTo = (is_string($route->getCallable()) ? $route->getCallable() : '');
                    $output->writeln('<info>'.$name.$method.$routeStr.$resolvesTo.'</info>');
                }
            }
        } catch (Exception $e) {
            $output->writeln($e->getMessage());
        }
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { if ( false === is_file ( 'composer.json' ) ) { throw new Exception ( 'Commands must be run from root of project.' ) ; } try { $ app = new App ( ) ; require 'src/routes.php' ; $ routes = $ app -> getContainer ( ) -> get ( 'router' ) -> getRoutes ( ) ; foreach ( $ routes as $ route ) { foreach ( $ route -> getMethods ( ) as $ method ) { $ name = str_pad ( $ route -> getName ( ) , 10 , ' ' , STR_PAD_LEFT ) ; $ method = str_pad ( $ method , 8 , ' ' , STR_PAD_RIGHT ) ; $ routeStr = str_pad ( $ route -> getPattern ( ) , 15 , ' ' , STR_PAD_RIGHT ) ; $ resolvesTo = ( is_string ( $ route -> getCallable ( ) ) ? $ route -> getCallable ( ) : '' ) ; $ output -> writeln ( '<info>' . $ name . $ method . $ routeStr . $ resolvesTo . '</info>' ) ; } } } catch ( Exception $ e ) { $ output -> writeln ( $ e -> getMessage ( ) ) ; } }
{@inheritdoc}
{