public function describe($pUri = null, $pOnlyRoutes = false)
    {
        $definition = array();

        if (!$pOnlyRoutes) {
            $definition['parameters'] = array(
                '_method' => array('description' => 'Can be used as HTTP METHOD if the client does not support HTTP methods.', 'type' => 'string',
                                   'values' => 'GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH'),
                '_suppress_status_code' => array('description' => 'Suppress the HTTP status code.', 'type' => 'boolean', 'values' => '1, 0'),
                '_format' => array('description' => 'Format of generated data. Can be added as suffix .json .xml', 'type' => 'string', 'values' => 'json, xml'),
            );
        }

        $definition['controller'] = array(
            'entryPoint' => $this->getTriggerUrl()
        );

        foreach ($this->routes as $routeUri => $routeMethods) {

            $matches = array();
            if (!$pUri || ($pUri && preg_match('|^'.$routeUri.'$|', $pUri, $matches))) {

                if ($matches) {
                    array_shift($matches);
                }
                $def = array();
                $def['uri'] = $this->getTriggerUrl().'/'.$routeUri;

                foreach ($routeMethods as $method => $phpMethod) {

                    if (is_string($phpMethod)) {
                        $ref = new \ReflectionClass($this->controller);
                        $refMethod = $ref->getMethod($phpMethod);
                    } else {
                        $refMethod = new \ReflectionFunction($phpMethod);
                    }

                    $def['methods'][strtoupper($method)] = $this->getMethodMetaData($refMethod, $matches);

                }
                $definition['controller']['routes'][$routeUri] = $def;
            }
        }

        if (!$pUri) {
            foreach ($this->controllers as $controller) {
                $definition['subController'][$controller->getTriggerUrl()] = $controller->describe(false, true);
            }
        }

        return $definition;
    }
public function describe($pUri = null, $pOnlyRoutes = false)
    {
        $definition = array();

        if (!$pOnlyRoutes) {
            $definition['parameters'] = array(
                '_method' => array('description' => 'Can be used as HTTP METHOD if the client does not support HTTP methods.', 'type' => 'string',
                                   'values' => 'GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH'),
                '_suppress_status_code' => array('description' => 'Suppress the HTTP status code.', 'type' => 'boolean', 'values' => '1, 0'),
                '_format' => array('description' => 'Format of generated data. Can be added as suffix .json .xml', 'type' => 'string', 'values' => 'json, xml'),
            );
        }

        $definition['controller'] = array(
            'entryPoint' => $this->getTriggerUrl()
        );

        foreach ($this->routes as $routeUri => $routeMethods) {

            $matches = array();
            if (!$pUri || ($pUri && preg_match('|^'.$routeUri.'$|', $pUri, $matches))) {

                if ($matches) {
                    array_shift($matches);
                }
                $def = array();
                $def['uri'] = $this->getTriggerUrl().'/'.$routeUri;

                foreach ($routeMethods as $method => $phpMethod) {

                    if (is_string($phpMethod)) {
                        $ref = new \ReflectionClass($this->controller);
                        $refMethod = $ref->getMethod($phpMethod);
                    } else {
                        $refMethod = new \ReflectionFunction($phpMethod);
                    }

                    $def['methods'][strtoupper($method)] = $this->getMethodMetaData($refMethod, $matches);

                }
                $definition['controller']['routes'][$routeUri] = $def;
            }
        }

        if (!$pUri) {
            foreach ($this->controllers as $controller) {
                $definition['subController'][$controller->getTriggerUrl()] = $controller->describe(false, true);
            }
        }

        return $definition;
    }
public function describe ( $ pUri = null , $ pOnlyRoutes = false ) { $ definition = array ( ) ; if ( ! $ pOnlyRoutes ) { $ definition [ 'parameters' ] = array ( '_method' => array ( 'description' => 'Can be used as HTTP METHOD if the client does not support HTTP methods.' , 'type' => 'string' , 'values' => 'GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH' ) , '_suppress_status_code' => array ( 'description' => 'Suppress the HTTP status code.' , 'type' => 'boolean' , 'values' => '1, 0' ) , '_format' => array ( 'description' => 'Format of generated data. Can be added as suffix .json .xml' , 'type' => 'string' , 'values' => 'json, xml' ) , ) ; } $ definition [ 'controller' ] = array ( 'entryPoint' => $ this -> getTriggerUrl ( ) ) ; foreach ( $ this -> routes as $ routeUri => $ routeMethods ) { $ matches = array ( ) ; if ( ! $ pUri || ( $ pUri && preg_match ( '|^' . $ routeUri . '$|' , $ pUri , $ matches ) ) ) { if ( $ matches ) { array_shift ( $ matches ) ; } $ def = array ( ) ; $ def [ 'uri' ] = $ this -> getTriggerUrl ( ) . '/' . $ routeUri ; foreach ( $ routeMethods as $ method => $ phpMethod ) { if ( is_string ( $ phpMethod ) ) { $ ref = new \ ReflectionClass ( $ this -> controller ) ; $ refMethod = $ ref -> getMethod ( $ phpMethod ) ; } else { $ refMethod = new \ ReflectionFunction ( $ phpMethod ) ; } $ def [ 'methods' ] [ strtoupper ( $ method ) ] = $ this -> getMethodMetaData ( $ refMethod , $ matches ) ; } $ definition [ 'controller' ] [ 'routes' ] [ $ routeUri ] = $ def ; } } if ( ! $ pUri ) { foreach ( $ this -> controllers as $ controller ) { $ definition [ 'subController' ] [ $ controller -> getTriggerUrl ( ) ] = $ controller -> describe ( false , true ) ; } } return $ definition ; }
Describe a route or the whole controller with all routes.

@param  string  $pUri
@param  boolean $pOnlyRoutes
@return array
Describe a route or the whole controller with all routes .