PHP Класс 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.
С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Автор: Titouan Galopin ([email protected])
Наследование: extends AbstractJsonRepository, implements Puli\Repository\Api\EditableRepository
Показать файл Открыть проект

Открытые методы

Метод Описание
clear ( )

Защищенные методы

Метод Описание
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 )

Описание методов

addFilesystemResource() защищенный Метод

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

clear() публичный Метод

public clear ( )

getReferencesForGlob() защищенный Метод

protected getReferencesForGlob ( $glob, $flags )

getReferencesForPath() защищенный Метод

protected getReferencesForPath ( $path )

getReferencesForRegex() защищенный Метод

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

getReferencesInDirectory() защищенный Метод

protected getReferencesInDirectory ( $path, $flags )

insertReference() защищенный Метод

protected insertReference ( $path, $reference )

removeReferences() защищенный Метод

protected removeReferences ( $glob )