src/Core/Core.php
protected function route($path)
    {
        /**
         * We check the pattern of the callPath
         * to construct the main call
         */
        if (!preg_match('/[a-zA-Z0-9]\.[a-zA-Z0-9]/', $path)) {
            throw new \OtherCode\FController\Exceptions\FControllerException("Incorrect module call pattern", 400);
        }

        /**
         * If the match is good we have to explode
         * the path in different parts.
         */
        $callPath = explode(".", $path);

        $module = strtolower($callPath[0]);
        $method = $callPath[1];

        /**
         * Now we have to check if the module that we want to
         * call is available
         */
        if (!array_key_exists($module, $this->modules)) {
            throw new \OtherCode\FController\Exceptions\NotFoundException("Module instance not found", 404);
        }

        /**
         * Finally we have to check that the requested method exists
         * in the module
         */
        if (!method_exists($this->modules[$module], $method)) {
            throw new \OtherCode\FController\Exceptions\NotFoundException("Module method requested is not available", 405);
        }

        /**
         * Build the final payload and
         * return it to the main call method
         */
        return (object)array(
            'module' => $module,
            'method' => $method
        );

    }
protected function route($path)
    {
        /**
         * We check the pattern of the callPath
         * to construct the main call
         */
        if (!preg_match('/[a-zA-Z0-9]\.[a-zA-Z0-9]/', $path)) {
            throw new \OtherCode\FController\Exceptions\FControllerException("Incorrect module call pattern", 400);
        }

        /**
         * If the match is good we have to explode
         * the path in different parts.
         */
        $callPath = explode(".", $path);

        $module = strtolower($callPath[0]);
        $method = $callPath[1];

        /**
         * Now we have to check if the module that we want to
         * call is available
         */
        if (!array_key_exists($module, $this->modules)) {
            throw new \OtherCode\FController\Exceptions\NotFoundException("Module instance not found", 404);
        }

        /**
         * Finally we have to check that the requested method exists
         * in the module
         */
        if (!method_exists($this->modules[$module], $method)) {
            throw new \OtherCode\FController\Exceptions\NotFoundException("Module method requested is not available", 405);
        }

        /**
         * Build the final payload and
         * return it to the main call method
         */
        return (object)array(
            'module' => $module,
            'method' => $method
        );

    }
protected function route ( $ path ) { /**
         * We check the pattern of the callPath
         * to construct the main call
         */ if ( ! preg_match ( '/[a-zA-Z0-9]\.[a-zA-Z0-9]/' , $ path ) ) { throw new \ OtherCode \ FController \ Exceptions \ FControllerException ( "Incorrect module call pattern" , 400 ) ; } /**
         * If the match is good we have to explode
         * the path in different parts.
         */ $ callPath = explode ( "." , $ path ) ; $ module = strtolower ( $ callPath [ 0 ] ) ; $ method = $ callPath [ 1 ] ; /**
         * Now we have to check if the module that we want to
         * call is available
         */ if ( ! array_key_exists ( $ module , $ this -> modules ) ) { throw new \ OtherCode \ FController \ Exceptions \ NotFoundException ( "Module instance not found" , 404 ) ; } /**
         * Finally we have to check that the requested method exists
         * in the module
         */ if ( ! method_exists ( $ this -> modules [ $ module ] , $ method ) ) { throw new \ OtherCode \ FController \ Exceptions \ NotFoundException ( "Module method requested is not available" , 405 ) ; } /**
         * Build the final payload and
         * return it to the main call method
         */ return ( object ) array ( 'module' => $ module , 'method' => $ method ) ; }
Check and build the payload call
@param $path
@return object
@throws \OtherCode\FController\Exceptions\FControllerException
@throws \OtherCode\FController\Exceptions\NotFoundException
Check and build the payload call