Raml\ApiDefinition::getResourceByPath PHP Method

getResourceByPath() public method

Get a resource by a path
public getResourceByPath ( string $path ) : Raml\Resource
$path string
return Raml\Resource
    public function getResourceByPath($path)
    {
        // get rid of everything after the ?
        $path = strtok($path, '?');
        $resources = $this->getResourcesAsArray($this->resources);
        foreach ($resources as $resource) {
            if ($path === $resource->getUri()) {
                return $resource;
            }
        }
        // we never returned so throw exception
        throw new ResourceNotFoundException($path);
    }