private function mapQueryToActionParameters(RouteEndpoint $route, RequestInterface $request) : array
    {
        $reflection = new ReflectionClass($route->getFullyQualifiedName());
        $method = $reflection->getMethod($route->getAction(true));
        $query = $request->getQuery();

        $mapper = [];
        foreach ($method->getParameters() as $parameter) {
            $defaultValue = null;
            if ($parameter->isDefaultValueAvailable()) {
                $defaultValue = $parameter->getDefaultValue();
            }

            $value = $query->get($parameter->getName(), $defaultValue);

            // We are missing a required parameter, so this is a bad request
            if ($value === null && !$parameter->allowsNull()) {
                throw HttpException::badRequest();
            }

            $mapper[$parameter->getName()] = $value;
        }

        return $mapper;
    }
private function mapQueryToActionParameters(RouteEndpoint $route, RequestInterface $request) : array
    {
        $reflection = new ReflectionClass($route->getFullyQualifiedName());
        $method = $reflection->getMethod($route->getAction(true));
        $query = $request->getQuery();

        $mapper = [];
        foreach ($method->getParameters() as $parameter) {
            $defaultValue = null;
            if ($parameter->isDefaultValueAvailable()) {
                $defaultValue = $parameter->getDefaultValue();
            }

            $value = $query->get($parameter->getName(), $defaultValue);

            // We are missing a required parameter, so this is a bad request
            if ($value === null && !$parameter->allowsNull()) {
                throw HttpException::badRequest();
            }

            $mapper[$parameter->getName()] = $value;
        }

        return $mapper;
    }
private function mapQueryToActionParameters ( RouteEndpoint $ route , RequestInterface $ request ) : array { $ reflection = new ReflectionClass ( $ route -> getFullyQualifiedName ( ) ) ; $ method = $ reflection -> getMethod ( $ route -> getAction ( true ) ) ; $ query = $ request -> getQuery ( ) ; $ mapper = [ ] ; foreach ( $ method -> getParameters ( ) as $ parameter ) { $ defaultValue = null ; if ( $ parameter -> isDefaultValueAvailable ( ) ) { $ defaultValue = $ parameter -> getDefaultValue ( ) ; } $ value = $ query -> get ( $ parameter -> getName ( ) , $ defaultValue ) ; // We are missing a required parameter, so this is a bad request if ( $ value === null && ! $ parameter -> allowsNull ( ) ) { throw HttpException :: badRequest ( ) ; } $ mapper [ $ parameter -> getName ( ) ] = $ value ; } return $ mapper ; }
Maps all the query parameters to the controller action parameters

@param RouteEndpoint $route

@return string[]
@throws HttpException
@throws ReflectionException
Maps all the query parameters to the controller action parameters