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;
    }