src/Service/RouteService.php
private function addRoute($method)
    {
        switch ($method) {
            case 'index':
                $methodMap          = ['GET'];
                $realRoute          = '$route';
                $controllerCallable = $this->controllerLocation.':indexAction';
                break;
            case 'get':
                $methodMap          = ['GET'];
                $realRoute          = '$route/{id}';
                $controllerCallable = $this->controllerLocation.':getAction';
                break;
            case 'post':
                $methodMap          = ['POST'];
                $realRoute          = '$route';
                $controllerCallable = $this->controllerLocation.':postAction';
                break;
            case 'put':
                $methodMap          = ['POST', 'PUT'];
                $realRoute          = '$route/{id}';
                $controllerCallable = $this->controllerLocation.':putAction';
                break;
            case 'delete':
                $methodMap          = ['DELETE'];
                $realRoute          = '$route/{id}';
                $controllerCallable = $this->controllerLocation.':deleteAction';
                break;
            default:
                throw new \Exception('Invalid method.'.$method);
                break;
        }
        $methodMap = "['".implode("', '", $methodMap)."']";
        $command   = strtr($this->template, ['$methodMap' => $methodMap, '$route' => $realRoute, '$controllerCallable' => $controllerCallable]);
        // $app->map(['GET'], '/trails', 'EarlyBird\Controllers\TrailsController:index');
        // $app->map(['GET'], '/texts/{stage}', 'EarlyBird\Controllers\TrailsController:get');
        // $app->map(['POST'], '/trails', 'EarlyBird\Controllers\TrailsController:post');
        // $app->map(['POST', 'PUT'], '/trails/{id}', 'EarlyBird\Controllers\TrailsController:put');
        $this->commands[] = $command;
    }
private function addRoute($method)
    {
        switch ($method) {
            case 'index':
                $methodMap          = ['GET'];
                $realRoute          = '$route';
                $controllerCallable = $this->controllerLocation.':indexAction';
                break;
            case 'get':
                $methodMap          = ['GET'];
                $realRoute          = '$route/{id}';
                $controllerCallable = $this->controllerLocation.':getAction';
                break;
            case 'post':
                $methodMap          = ['POST'];
                $realRoute          = '$route';
                $controllerCallable = $this->controllerLocation.':postAction';
                break;
            case 'put':
                $methodMap          = ['POST', 'PUT'];
                $realRoute          = '$route/{id}';
                $controllerCallable = $this->controllerLocation.':putAction';
                break;
            case 'delete':
                $methodMap          = ['DELETE'];
                $realRoute          = '$route/{id}';
                $controllerCallable = $this->controllerLocation.':deleteAction';
                break;
            default:
                throw new \Exception('Invalid method.'.$method);
                break;
        }
        $methodMap = "['".implode("', '", $methodMap)."']";
        $command   = strtr($this->template, ['$methodMap' => $methodMap, '$route' => $realRoute, '$controllerCallable' => $controllerCallable]);
        // $app->map(['GET'], '/trails', 'EarlyBird\Controllers\TrailsController:index');
        // $app->map(['GET'], '/texts/{stage}', 'EarlyBird\Controllers\TrailsController:get');
        // $app->map(['POST'], '/trails', 'EarlyBird\Controllers\TrailsController:post');
        // $app->map(['POST', 'PUT'], '/trails/{id}', 'EarlyBird\Controllers\TrailsController:put');
        $this->commands[] = $command;
    }
Process the requrested method into a route template

@param string $method

@return void