PHP 클래스 Puli\Repository\AbstractJsonRepository

The generated JSON file is described by res/schema/repository-schema-1.0.json.
부터: 1.0
저자: Bernhard Schussek ([email protected])
저자: Titouan Galopin ([email protected])
상속: extends AbstractEditableRepository, implements Psr\Log\LoggerAwareInterface
파일 보기 프로젝트 열기: puli/repository 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$baseDirectory string
$json array

공개 메소드들

메소드 설명
__construct ( string $path, string $baseDirectory, boolean $validateJson = false, Puli\Repository\Api\ChangeStream\ChangeStream $changeStream = null ) Creates a new repository.
add ( $path, $resource )
clear ( )
contains ( $query, $language = 'glob' )
find ( $query, $language = 'glob' )
get ( $path )
hasChildren ( $path )
listChildren ( $path )
remove ( $query, $language = 'glob' )
setLogger ( Psr\Log\LoggerInterface $logger = null )

보호된 메소드들

메소드 설명
addFilesystemResource ( string $path, Puli\Repository\Api\Resource\FilesystemResource $resource ) Adds a filesystem resource to the JSON file.
createResource ( string $path, string | null $reference ) : Puli\Repository\Api\Resource\PuliResource Turns a reference into a resource.
flush ( ) Writes the JSON file.
getReferencesForGlob ( string $glob, integer $flags ) : string[] | null[] Returns the references matching a given Puli path glob.
getReferencesForPath ( string $path ) : string[] | null[] Returns the references for a given Puli path.
getReferencesForRegex ( string $staticPrefix, string $regex, integer $flags ) : string[] | null[] Returns the references matching a given Puli path regular expression.
getReferencesInDirectory ( string $path, integer $flags ) : string[] | null[] Returns the references in a given Puli path.
insertReference ( string $path, string | null $reference ) Inserts a path reference into the JSON file.
isFilesystemReference ( string $reference ) : boolean Returns whether a reference contains an absolute or relative filesystem path.
isLinkReference ( string $reference ) : boolean Returns whether a reference contains a link.
load ( ) Loads the JSON file.
log ( mixed $level, string $message ) Logs a message.
logReferenceNotFound ( string $path, string $reference, string $absoluteReference ) Logs a warning that a reference could not be found.
removeReferences ( string $glob ) Removes all path references matching the given glob from the JSON file.

비공개 메소드들

메소드 설명
addResource ( string $path, Puli\Repository\Api\Resource\FilesystemResource | LinkResource $resource ) Adds a resource to the repository.
createResources ( array $references ) : array Turns a list of references into a list of resources.
ensureDirectoryExists ( string $path ) Adds all ancestor directories of a path to the repository.
getShortClassName ( string $className ) : string Returns the short name of a fully-qualified class name.

메소드 상세

__construct() 공개 메소드

Creates a new repository.
public __construct ( string $path, string $baseDirectory, boolean $validateJson = false, Puli\Repository\Api\ChangeStream\ChangeStream $changeStream = null )
$path string The path to the JSON file. If relative, it must be relative to the base directory.
$baseDirectory string The base directory of the store. Paths inside that directory are stored as relative paths. Paths outside that directory are stored as absolute paths.
$validateJson boolean Whether to validate the JSON file against the schema. Slow but spots problems.
$changeStream Puli\Repository\Api\ChangeStream\ChangeStream If provided, the repository will append resource changes to this change stream.

add() 공개 메소드

public add ( $path, $resource )

addFilesystemResource() 보호된 메소드

Adds a filesystem resource to the JSON file.
protected addFilesystemResource ( string $path, Puli\Repository\Api\Resource\FilesystemResource $resource )
$path string The Puli path.
$resource Puli\Repository\Api\Resource\FilesystemResource The resource to add.

clear() 공개 메소드

public clear ( )

contains() 공개 메소드

public contains ( $query, $language = 'glob' )

createResource() 보호된 메소드

Turns a reference into a resource.
protected createResource ( string $path, string | null $reference ) : Puli\Repository\Api\Resource\PuliResource
$path string The Puli path.
$reference string | null The reference.
리턴 Puli\Repository\Api\Resource\PuliResource The resource.

find() 공개 메소드

public find ( $query, $language = 'glob' )

flush() 보호된 메소드

Writes the JSON file.
protected flush ( )

get() 공개 메소드

public get ( $path )

getReferencesForGlob() 추상적인 보호된 메소드

Each reference returned by this method can be: * null * a link starting with @ * an absolute filesystem path The keys of the returned array are Puli paths. Their order is undefined. The flag STOP_ON_FIRST may be used to stop the search at the first result.
abstract protected getReferencesForGlob ( string $glob, integer $flags ) : string[] | null[]
$glob string The glob.
$flags integer A bitwise combination of the flag constants in this class.
리턴 string[] | null[] A one-level array of references with Puli paths as keys.

getReferencesForPath() 추상적인 보호된 메소드

Each reference returned by this method can be: * null * a link starting with @ * an absolute filesystem path The result has either one entry or none, if no path was found. The key of the single entry is the path passed to this method.
abstract protected getReferencesForPath ( string $path ) : string[] | null[]
$path string The Puli path.
리턴 string[] | null[] A one-level array of references with Puli paths as keys. The array has at most one entry.

getReferencesForRegex() 추상적인 보호된 메소드

Each reference returned by this method can be: * null * a link starting with @ * an absolute filesystem path The keys of the returned array are Puli paths. Their order is undefined. The flag STOP_ON_FIRST may be used to stop the search at the first result.
abstract protected getReferencesForRegex ( string $staticPrefix, string $regex, integer $flags ) : string[] | null[]
$staticPrefix string The static prefix of all Puli paths matching the regular expression.
$regex string The regular expression.
$flags integer A bitwise combination of the flag constants in this class.
리턴 string[] | null[] A one-level array of references with Puli paths as keys.

getReferencesInDirectory() 추상적인 보호된 메소드

Each reference returned by this method can be: * null * a link starting with @ * an absolute filesystem path The keys of the returned array are Puli paths. Their order is undefined. The flag STOP_ON_FIRST may be used to stop the search at the first result.
abstract protected getReferencesInDirectory ( string $path, integer $flags ) : string[] | null[]
$path string The Puli path.
$flags integer A bitwise combination of the flag constants in this class.
리턴 string[] | null[] A one-level array of references with Puli paths as keys.

hasChildren() 공개 메소드

public hasChildren ( $path )

insertReference() 추상적인 보호된 메소드

The path reference can be: * a link starting with @ * an absolute filesystem path
abstract protected insertReference ( string $path, string | null $reference )
$path string The Puli path.
$reference string | null The path reference.

isFilesystemReference() 보호된 메소드

Returns whether a reference contains an absolute or relative filesystem path.
protected isFilesystemReference ( string $reference ) : boolean
$reference string The reference.
리턴 boolean Whether the reference contains a filesystem path.

isLinkReference() 보호된 메소드

Returns whether a reference contains a link.
protected isLinkReference ( string $reference ) : boolean
$reference string The reference.
리턴 boolean Whether the reference contains a link.

listChildren() 공개 메소드

public listChildren ( $path )

load() 보호된 메소드

Loads the JSON file.
protected load ( )

log() 보호된 메소드

Logs a message.
protected log ( mixed $level, string $message )
$level mixed One of the level constants in {@link LogLevel}.
$message string The message.

logReferenceNotFound() 보호된 메소드

Logs a warning that a reference could not be found.
protected logReferenceNotFound ( string $path, string $reference, string $absoluteReference )
$path string The Puli path of a path mapping.
$reference string The reference that was not found.
$absoluteReference string The absolute filesystem path of the reference.

remove() 공개 메소드

public remove ( $query, $language = 'glob' )

removeReferences() 추상적인 보호된 메소드

Removes all path references matching the given glob from the JSON file.
abstract protected removeReferences ( string $glob )
$glob string The glob for a list of Puli paths.

setLogger() 공개 메소드

public setLogger ( Psr\Log\LoggerInterface $logger = null )
$logger Psr\Log\LoggerInterface

프로퍼티 상세

$baseDirectory 보호되어 있는 프로퍼티

protected string $baseDirectory
리턴 string

$json 보호되어 있는 프로퍼티

protected array $json
리턴 array