public function rest($url, $controller_name, array $where = [])
    {
        if (!is_string($controller_name) && !is_array($controller_name)) {
            throw new ApplicationException(
                'The first parameter must be an array or a string',
                E_ERROR
            );
        }

        $ignore_method = [];

        $controller = $controller_name;

        if (is_array($controller_name)) {
            // Get controller
            if (isset($controller_name['controller'])) {
                $controller = $controller_name['controller'];

                unset($controller_name['controller']);
            }

            // Get all ignores methods
            if (isset($controller_name['ignores'])) {
                $ignore_method = $controller_name['ignores'];

                unset($controller_name['ignores']);
            }
        }

        if (is_null($controller) || !is_string($controller)) {
            throw new ApplicationException(
                "[REST] No defined controller!",
                E_ERROR
            );
        }

        // Normalize url
        $url = preg_replace('/\/+$/', '', $url);

        Resource::make($url, $controller, $where, $ignore_method);

        return $this;
    }
public function rest($url, $controller_name, array $where = [])
    {
        if (!is_string($controller_name) && !is_array($controller_name)) {
            throw new ApplicationException(
                'The first parameter must be an array or a string',
                E_ERROR
            );
        }

        $ignore_method = [];

        $controller = $controller_name;

        if (is_array($controller_name)) {
            // Get controller
            if (isset($controller_name['controller'])) {
                $controller = $controller_name['controller'];

                unset($controller_name['controller']);
            }

            // Get all ignores methods
            if (isset($controller_name['ignores'])) {
                $ignore_method = $controller_name['ignores'];

                unset($controller_name['ignores']);
            }
        }

        if (is_null($controller) || !is_string($controller)) {
            throw new ApplicationException(
                "[REST] No defined controller!",
                E_ERROR
            );
        }

        // Normalize url
        $url = preg_replace('/\/+$/', '', $url);

        Resource::make($url, $controller, $where, $ignore_method);

        return $this;
    }
public function rest ( $ url , $ controller_name , array $ where = [ ] ) { if ( ! is_string ( $ controller_name ) && ! is_array ( $ controller_name ) ) { throw new ApplicationException ( 'The first parameter must be an array or a string' , E_ERROR ) ; } $ ignore_method = [ ] ; $ controller = $ controller_name ; if ( is_array ( $ controller_name ) ) { // Get controller if ( isset ( $ controller_name [ 'controller' ] ) ) { $ controller = $ controller_name [ 'controller' ] ; unset ( $ controller_name [ 'controller' ] ) ; } // Get all ignores methods if ( isset ( $ controller_name [ 'ignores' ] ) ) { $ ignore_method = $ controller_name [ 'ignores' ] ; unset ( $ controller_name [ 'ignores' ] ) ; } } if ( is_null ( $ controller ) || ! is_string ( $ controller ) ) { throw new ApplicationException ( "[REST] No defined controller!" , E_ERROR ) ; } // Normalize url $ url = preg_replace ( '/\/+$/' , '' , $ url ) ; Resource :: make ( $ url , $ controller , $ where , $ ignore_method ) ; return $ this ; }
REST API Maker.

@param string $url
@param string|array $controller_name
@param array $where
@return Application

@throws ApplicationException
REST API Maker .