private function getMethodsAsArray(array $resources)
    {
        $all = [];
        $baseUrl = $this->getBaseUri();
        $protocols = $this->protocols;

        // Loop over each resource to build out the full URI's that it has.
        foreach ($resources as $resource) {
            $path = $resource->getUri();

            foreach ($resource->getMethods() as $method) {
                $all[$method->getType() . ' ' . $path] = new BasicRoute(
                    $baseUrl,
                    $path,
                    $protocols,
                    $method->getType(),
                    $resource->getUriParameters(),
                    $resource->getMethod($method->getType())
                );
            }

            $all = \array_merge_recursive($all, $this->getMethodsAsArray($resource->getResources()));
        }

        return $all;
    }
private function getMethodsAsArray(array $resources)
    {
        $all = [];
        $baseUrl = $this->getBaseUri();
        $protocols = $this->protocols;

        // Loop over each resource to build out the full URI's that it has.
        foreach ($resources as $resource) {
            $path = $resource->getUri();

            foreach ($resource->getMethods() as $method) {
                $all[$method->getType() . ' ' . $path] = new BasicRoute(
                    $baseUrl,
                    $path,
                    $protocols,
                    $method->getType(),
                    $resource->getUriParameters(),
                    $resource->getMethod($method->getType())
                );
            }

            $all = \array_merge_recursive($all, $this->getMethodsAsArray($resource->getResources()));
        }

        return $all;
    }
private function getMethodsAsArray ( array $ resources ) { $ all = [ ] ; $ baseUrl = $ this -> getBaseUri ( ) ; $ protocols = $ this -> protocols ; // Loop over each resource to build out the full URI's that it has. foreach ( $ resources as $ resource ) { $ path = $ resource -> getUri ( ) ; foreach ( $ resource -> getMethods ( ) as $ method ) { $ all [ $ method -> getType ( ) . ' ' . $ path ] = new BasicRoute ( $ baseUrl , $ path , $ protocols , $ method -> getType ( ) , $ resource -> getUriParameters ( ) , $ resource -> getMethod ( $ method -> getType ( ) ) ) ; } $ all = \ array_merge_recursive ( $ all , $ this -> getMethodsAsArray ( $ resource -> getResources ( ) ) ) ; } return $ all ; }
Recursive function that generates a flat array of the entire API Definition

GET /songs => [api.example.org, /songs, GET, [https], Raml\Method]
GET /songs/{songId} => [api.example.org, /songs/{songId}, GET, [https], Raml\Method]

@param resource[] $resources
@return BasicRoute[]
Recursive function that generates a flat array of the entire API Definition