PHP Class Puli\Repository\OptimizedJsonRepository

The generated JSON file is described by res/schema/repository-schema-1.0.json. Resources can be added with the method {@link add()}: php use Puli\Repository\OptimizedJsonRepository; $repo = new OptimizedJsonRepository('/path/to/repository.json', '/path/to/project'); $repo->add('/css', new DirectoryResource('/path/to/project/res/css')); When adding a resource, the added filesystem path is stored in the JSON file under the key of the Puli path. The path is stored relatively to the base directory passed to the constructor. Directories will be expanded and all nested files will be added to the mapping file as well: json { "/css": "res/css", "/css/style.css": "res/css/style.css" } Mapped resources can be read with the method {@link get()}: php $cssPath = $repo->get('/css')->getFilesystemPath(); You can also access nested files: php echo $repo->get('/css/style.css')->getBody(); Since nested files are searched during {@link add()} and added to the JSON file, this repository does not detect any files that you add to a directory after adding that directory to the repository. This means that accessing files is very fast, but also that the usage of this repository implementation can be cumbersome in development environments. There you are recommended to use {@link JsonRepository} instead.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Author: Titouan Galopin ([email protected])
Inheritance: extends AbstractJsonRepository, implements Puli\Repository\Api\EditableRepository
ファイルを表示 Open project: puli/repository

Public Methods

Method Description
clear ( )

Protected Methods

Method Description
addFilesystemResource ( $path, Puli\Repository\Api\Resource\FilesystemResource $resource )
getReferencesForGlob ( $glob, $flags )
getReferencesForPath ( $path )
getReferencesForRegex ( $staticPrefix, $regex, $flags )
getReferencesInDirectory ( $path, $flags )
insertReference ( $path, $reference )
removeReferences ( $glob )

Method Details

addFilesystemResource() protected method

protected addFilesystemResource ( $path, Puli\Repository\Api\Resource\FilesystemResource $resource )
$resource Puli\Repository\Api\Resource\FilesystemResource

clear() public method

public clear ( )

getReferencesForGlob() protected method

protected getReferencesForGlob ( $glob, $flags )

getReferencesForPath() protected method

protected getReferencesForPath ( $path )

getReferencesForRegex() protected method

protected getReferencesForRegex ( $staticPrefix, $regex, $flags )

getReferencesInDirectory() protected method

protected getReferencesInDirectory ( $path, $flags )

insertReference() protected method

protected insertReference ( $path, $reference )

removeReferences() protected method

protected removeReferences ( $glob )