src/Yggdrasil/Core/Routing/RestRouter.php
private function detectRouteForWithIdentifierPattern(array $matches): ?Route
    {
        $actions = [
            'GET' => 'singleAction',
            'PUT' => 'editAction',
            'DELETE' => 'destroyAction'
        ];

        if (!isset($actions[$this->request->getMethod()])) {
            return null;
        }

        $controllerName = implode('', array_map('ucfirst', explode('-', $matches['controller'])));
        $controller = $this->configuration->getControllerNamespace() . $controllerName . 'Controller';

        return (new Route())
            ->setController($controller)
            ->setAction($actions[$this->request->getMethod()])
            ->setActionParams([$matches['id']]);
    }
private function detectRouteForWithIdentifierPattern(array $matches): ?Route
    {
        $actions = [
            'GET' => 'singleAction',
            'PUT' => 'editAction',
            'DELETE' => 'destroyAction'
        ];

        if (!isset($actions[$this->request->getMethod()])) {
            return null;
        }

        $controllerName = implode('', array_map('ucfirst', explode('-', $matches['controller'])));
        $controller = $this->configuration->getControllerNamespace() . $controllerName . 'Controller';

        return (new Route())
            ->setController($controller)
            ->setAction($actions[$this->request->getMethod()])
            ->setActionParams([$matches['id']]);
    }
private function detectRouteForWithIdentifierPattern ( array $ matches ) : ? Route { $ actions = [ 'GET' => 'singleAction' , 'PUT' => 'editAction' , 'DELETE' => 'destroyAction' ] ; if ( ! isset ( $ actions [ $ this -> request -> getMethod ( ) ] ) ) { return null ; } $ controllerName = implode ( '' , array_map ( 'ucfirst' , explode ( '-' , $ matches [ 'controller' ] ) ) ) ; $ controller = $ this -> configuration -> getControllerNamespace ( ) . $ controllerName . 'Controller' ; return ( new Route ( ) ) -> setController ( $ controller ) -> setAction ( $ actions [ $ this -> request -> getMethod ( ) ] ) -> setActionParams ( [ $ matches [ 'id' ] ] ) ; }
Returns route for WITH_IDENTIFIER query pattern

@param array $matches Result of regular expression match
@return Route?
Returns route for WITH_IDENTIFIER query pattern