public function collectRoutes()
    {
        if ($this->collectRoutesExclude == '*') return $this;

        $methods = get_class_methods($this->controller);
        foreach ($methods as $method) {
            if (in_array($method, $this->collectRoutesExclude)) continue;

            $info = explode('/', preg_replace('/([a-z]*)(([A-Z]+)([a-zA-Z0-9_]*))/', '$1/$2', $method));
            $uri  = $this->camelCase2Dashes((empty($info[1]) ? '' : $info[1]));

            $httpMethod  = $info[0];
            if ($httpMethod == 'all') {
                $httpMethod = '_all_';
            }

            $reflectionMethod = new \ReflectionMethod($this->controller, $method);
            if ($reflectionMethod->isPrivate()) continue;

            $phpDocs = $this->getMethodMetaData($reflectionMethod);
            if (isset($phpDocs['url'])) {
                if (isset($phpDocs['url']['url'])) {
                    //only one route
                    $this->routes[$phpDocs['url']['url']][$httpMethod] = $method;
                } else {
                    foreach($phpDocs['url'] as $urlAnnotation) {
                        $this->routes[$urlAnnotation['url']][$httpMethod] = $method;
                    }
                }
            } else {
                $this->routes[$uri][$httpMethod] = $method;
            }

        }

        return $this;
    }
public function collectRoutes()
    {
        if ($this->collectRoutesExclude == '*') return $this;

        $methods = get_class_methods($this->controller);
        foreach ($methods as $method) {
            if (in_array($method, $this->collectRoutesExclude)) continue;

            $info = explode('/', preg_replace('/([a-z]*)(([A-Z]+)([a-zA-Z0-9_]*))/', '$1/$2', $method));
            $uri  = $this->camelCase2Dashes((empty($info[1]) ? '' : $info[1]));

            $httpMethod  = $info[0];
            if ($httpMethod == 'all') {
                $httpMethod = '_all_';
            }

            $reflectionMethod = new \ReflectionMethod($this->controller, $method);
            if ($reflectionMethod->isPrivate()) continue;

            $phpDocs = $this->getMethodMetaData($reflectionMethod);
            if (isset($phpDocs['url'])) {
                if (isset($phpDocs['url']['url'])) {
                    //only one route
                    $this->routes[$phpDocs['url']['url']][$httpMethod] = $method;
                } else {
                    foreach($phpDocs['url'] as $urlAnnotation) {
                        $this->routes[$urlAnnotation['url']][$httpMethod] = $method;
                    }
                }
            } else {
                $this->routes[$uri][$httpMethod] = $method;
            }

        }

        return $this;
    }
public function collectRoutes ( ) { if ( $ this -> collectRoutesExclude == '*' ) return $ this ; $ methods = get_class_methods ( $ this -> controller ) ; foreach ( $ methods as $ method ) { if ( in_array ( $ method , $ this -> collectRoutesExclude ) ) continue ; $ info = explode ( '/' , preg_replace ( '/([a-z]*)(([A-Z]+)([a-zA-Z0-9_]*))/' , '$1/$2' , $ method ) ) ; $ uri = $ this -> camelCase2Dashes ( ( empty ( $ info [ 1 ] ) ? '' : $ info [ 1 ] ) ) ; $ httpMethod = $ info [ 0 ] ; if ( $ httpMethod == 'all' ) { $ httpMethod = '_all_' ; } $ reflectionMethod = new \ ReflectionMethod ( $ this -> controller , $ method ) ; if ( $ reflectionMethod -> isPrivate ( ) ) continue ; $ phpDocs = $ this -> getMethodMetaData ( $ reflectionMethod ) ; if ( isset ( $ phpDocs [ 'url' ] ) ) { if ( isset ( $ phpDocs [ 'url' ] [ 'url' ] ) ) { //only one route $ this -> routes [ $ phpDocs [ 'url' ] [ 'url' ] ] [ $ httpMethod ] = $ method ; } else { foreach ( $ phpDocs [ 'url' ] as $ urlAnnotation ) { $ this -> routes [ $ urlAnnotation [ 'url' ] ] [ $ httpMethod ] = $ method ; } } } else { $ this -> routes [ $ uri ] [ $ httpMethod ] = $ method ; } } return $ this ; }
Setup automatic routes.

@return Server
Setup automatic routes .