PHP Interface Puli\Repository\Api\ResourceRepository

A resource repository is similar to a filesystem. It stores {@link PuliResource} objects, each of which has a path in the repository: php $resource = $repo->get('/css/style.css'); Resources may have child resources. These can be accessed with {@link listChildren()}: php $resource = $repo->get('/css'); foreach ($resource->listChildren() as $name => $resource) { ... }
Since: 1.0
Author: Bernhard Schussek ([email protected])
Author: Titouan Galopin ([email protected])
Exibir arquivo Open project: puli/repository Interface Usage Examples

Public Methods

Method Description
contains ( string $query, string $language = 'glob' ) : boolean Returns whether any resources match a query.
find ( string $query, string $language = 'glob' ) : Puli\Repository\Api\ResourceCollection Returns the resources matching a query.
get ( string $path ) : Puli\Repository\Api\Resource\PuliResource Returns the resource at the given path.
getVersions ( string $path ) : VersionList Returns all versions of a resource.
hasChildren ( string $path ) : boolean Returns whether a resource has child resources.
listChildren ( string $path ) : Puli\Repository\Api\ResourceCollection Lists the child resources of a resource.

Method Details

contains() public method

Returns whether any resources match a query.
public contains ( string $query, string $language = 'glob' ) : boolean
$query string A resource query.
$language string The language of the query. All implementations must support the language "glob".
return boolean Returns `true` if any resources exist that match the query.

find() public method

Returns the resources matching a query.
public find ( string $query, string $language = 'glob' ) : Puli\Repository\Api\ResourceCollection
$query string A resource query.
$language string The language of the query. All implementations must support the language "glob".
return Puli\Repository\Api\ResourceCollection The resources matching the query.

get() public method

Returns the resource at the given path.
public get ( string $path ) : Puli\Repository\Api\Resource\PuliResource
$path string The path to the resource. Must start with "/". "." and ".." segments in the path are supported.
return Puli\Repository\Api\Resource\PuliResource The resource at this path.

getVersions() public method

Returns all versions of a resource.
public getVersions ( string $path ) : VersionList
$path string The path to the resource.
return Puli\Repository\Api\ChangeStream\VersionList The versions stored for this path.

hasChildren() public method

Returns whether a resource has child resources.
public hasChildren ( string $path ) : boolean
$path string The path to the resource. Must start with "/". "." and ".." segments in the path are supported.
return boolean Returns `true` if the resource has child resources.

listChildren() public method

Lists the child resources of a resource.
public listChildren ( string $path ) : Puli\Repository\Api\ResourceCollection
$path string The path to the resource. Must start with "/". "." and ".." segments in the path are supported.
return Puli\Repository\Api\ResourceCollection The child resources of the resource.