PHP Класс Puli\Manager\Api\Repository\PathMapping

The filesystem paths are passed in the form of *path references* that are either paths relative to the module's root directory or paths relative to another modules's root directory prefixed with @vendor/module:, where "vendor/module" is the name of the referenced module. The path references are turned into absolute filesystem paths when {@link load()} is called.
С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( string $repositoryPath, string | string[] $pathReferences ) Creates a new path mapping.
addConflict ( Puli\Manager\Api\Repository\PathConflict $conflict ) Adds a conflict to the mapping.
getConflictingMappings ( ) : PathMapping[] Returns all conflicting path mappings.
getConflictingModules ( ) : ModuleList Returns all modules with conflicting path mappings.
getConflicts ( ) : Puli\Manager\Api\Repository\PathConflict[] Returns the conflicts of the mapping.
getContainingModule ( ) : Puli\Manager\Api\Module\Module Returns the module that contains the mapping.
getFilesystemPaths ( ) : string[] Returns the referenced filesystem paths.
getLoadErrors ( ) : Exceptio\Exception[] Returns the errors that occurred during loading of the mapping.
getPathReferences ( ) : string[] Returns the path references.
getRepositoryPath ( ) : string Returns the repository path.
getState ( ) : integer Returns the state of the mapping.
isConflicting ( ) : boolean Returns whether the mapping conflicts with a mapping in another module.
isEnabled ( ) : boolean Returns whether the mapping is enabled.
isLoaded ( ) : boolean Returns whether the mapping is loaded.
isNotFound ( ) : boolean Returns whether the path referenced by the mapping was not found.
listPathMappings ( ) : string[] Lists all filesystem path to repository path mappings of this mapping.
listRepositoryPaths ( ) : string[] Lists all mapped repository paths.
load ( Puli\Manager\Api\Module\Module $containingModule, ModuleList $modules ) Loads the mapping.
removeConflict ( Puli\Manager\Api\Repository\PathConflict $conflict ) Removes a conflict from the mapping.
unload ( ) Unloads the mapping.

Приватные методы

Метод Описание
assertFileExists ( $absolutePath, $relativePath, Puli\Manager\Api\Module\Module $containingModule )
makeAbsolute ( $relativePath, Puli\Manager\Api\Module\Module $containingModule, ModuleList $modules )
refreshState ( )

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

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

Creates a new path mapping.
public __construct ( string $repositoryPath, string | string[] $pathReferences )
$repositoryPath string The repository path.
$pathReferences string | string[] The path references.

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

A mapping can refer to at most one conflict per conflicting repository path. If the same conflict is added twice, the second addition is ignored. If a different conflict is added for an existing repository path, the previous conflict is removed before adding the new conflict for the repository path. The repository path of the conflict must either be the repository path of the mapping or any path within. If a conflict with a different path is added, an exception is thrown. The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public addConflict ( Puli\Manager\Api\Repository\PathConflict $conflict )
$conflict Puli\Manager\Api\Repository\PathConflict The conflict to be added.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getConflictingMappings ( ) : PathMapping[]
Результат PathMapping[] The conflicting path mappings.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getConflictingModules ( ) : ModuleList
Результат Puli\Manager\Api\Module\ModuleList The conflicting modules.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getConflicts ( ) : Puli\Manager\Api\Repository\PathConflict[]
Результат Puli\Manager\Api\Repository\PathConflict[] The conflicts.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getContainingModule ( ) : Puli\Manager\Api\Module\Module
Результат Puli\Manager\Api\Module\Module The containing module or `null` if the mapping has not been loaded.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getFilesystemPaths ( ) : string[]
Результат string[] The absolute filesystem paths.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getLoadErrors ( ) : Exceptio\Exception[]
Результат Exceptio\Exception[] The errors that occurred during loading. If the returned array is empty, the mapping was loaded successfully.

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

The path references refer to filesystem paths. A path reference is either: * a path relative to the root directory of the containing module; * a path relative to the root directory of another module, prefixed with @vendor/module:, where "vendor/module" is the name of the referenced module.
public getPathReferences ( ) : string[]
Результат string[] The path references.

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

Returns the repository path.
public getRepositoryPath ( ) : string
Результат string The repository path.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getState ( ) : integer
Результат integer One of the {@link PathMappingState} constants.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
См. также: PathMappingState::CONFLICT
public isConflicting ( ) : boolean
Результат boolean Returns `true` if the state is {@link PathMappingState::CONFLICT}.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
См. также: PathMappingState::ENABLED
public isEnabled ( ) : boolean
Результат boolean Returns `true` if the state is {@link PathMappingState::ENABLED}.

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

Returns whether the mapping is loaded.
public isLoaded ( ) : boolean
Результат boolean Returns `true` if {@link load()} was called.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
См. также: PathMappingState::NOT_FOUND
public isNotFound ( ) : boolean
Результат boolean Returns `true` if the state is {@link PathMappingState::NOT_FOUND}.

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

Lists all filesystem path to repository path mappings of this mapping.
public listPathMappings ( ) : string[]
Результат string[] An array of repository paths with their corresponding filesystem paths as keys. If the mapping has multiple filesystem paths, then repository paths may occur multiple times in the returned array.

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

Contrary to {@link getRepositoryPath()}, this array also contains all nested repository paths that are mapped by this mapping.
public listRepositoryPaths ( ) : string[]
Результат string[] A list of all mapped repository paths.

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

Loads the mapping.
public load ( Puli\Manager\Api\Module\Module $containingModule, ModuleList $modules )
$containingModule Puli\Manager\Api\Module\Module The module that contains the mapping.
$modules Puli\Manager\Api\Module\ModuleList A list of modules that can be referenced using `@vendor/module:` prefixes in the path references.

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

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public removeConflict ( Puli\Manager\Api\Repository\PathConflict $conflict )
$conflict Puli\Manager\Api\Repository\PathConflict The conflict to remove.

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

This method reverses the effects of {@link load()}. Additionally, all associated conflicts are dereferenced.
public unload ( )