PHP Class Puli\Manager\Api\Module\ModuleFile

Since: 1.0
Author: Bernhard Schussek ([email protected])
Show file Open project: puli/manager Class Usage Examples

Public Methods

Method Description
__construct ( string | null $moduleName = null, string | null $path = null ) Creates a new module file.
addBindingDescriptor ( Puli\Manager\Api\Discovery\BindingDescriptor $descriptor ) Adds a binding descriptor.
addDependency ( string $moduleName ) Adds a dependency to a module.
addExtraKeys ( array $values ) Sets multiple extra keys at once.
addPathMapping ( PathMapping $mapping ) Adds a path mapping.
addTypeDescriptor ( Puli\Manager\Api\Discovery\BindingTypeDescriptor $descriptor ) Adds a type descriptor.
clearBindingDescriptors ( ) Removes all binding descriptors.
clearDependencies ( ) Removes all dependencies.
clearExtraKeys ( ) Removes all extra keys.
clearPathMappings ( ) Removes all path mappings.
clearTypeDescriptors ( ) Removes all type descriptors.
getBindingDescriptor ( Rhumsaa\Uuid\Uuid $uuid ) : Puli\Manager\Api\Discovery\BindingDescriptor Returns the binding descriptor with the given UUID.
getBindingDescriptors ( ) : Puli\Manager\Api\Discovery\BindingDescriptor[] Returns the binding descriptors.
getDependencies ( ) : string[] Returns the names of the modules this module overrides.
getExtraKey ( string $key, mixed $default = null ) : mixed Returns the value of an extra key.
getExtraKeys ( ) : array Returns all stored extra keys.
getModuleName ( ) : string | null Returns the module name.
getPath ( ) : string | null Returns the path to the module file.
getPathMapping ( string $repositoryPath ) : PathMapping Returns the path mapping for a repository path.
getPathMappings ( ) : PathMapping[] Returns the path mappings.
getTypeDescriptor ( string $typeName ) : Puli\Manager\Api\Discovery\BindingTypeDescriptor Returns the type descriptor with the given name.
getTypeDescriptors ( ) : Puli\Manager\Api\Discovery\BindingTypeDescriptor[] Returns the type descriptors.
getVersion ( ) : string Returns the version of the module file.
hasBindingDescriptor ( Rhumsaa\Uuid\Uuid $uuid ) : boolean Returns whether the binding descriptor exists in this file.
hasBindingDescriptors ( ) : boolean Returns whether the file contains any binding descriptors.
hasDependencies ( ) : boolean Returns whether the module has dependencies on other modules.
hasDependency ( string $moduleName ) : boolean Returns whether the module depends on a given module.
hasExtraKey ( string $key ) : boolean Returns whether the given extra key exists.
hasExtraKeys ( ) : boolean Returns whether the file contains any extra keys.
hasPathMapping ( string $repositoryPath ) : boolean Returns whether the file contains a path mapping for a repository path.
hasPathMappings ( ) : boolean Returns whether the file contains any path mappings.
hasTypeDescriptor ( string $typeName ) : boolean Returns whether a type is defined in this file.
hasTypeDescriptors ( ) : boolean Returns whether the file contains any type descriptors.
removeBindingDescriptor ( Rhumsaa\Uuid\Uuid $uuid ) Removes a binding descriptor.
removeDependency ( string $moduleName ) Adds a dependency to a module.
removeExtraKey ( string $key ) Removes an extra key.
removePathMapping ( string $repositoryPath ) Removes the path mapping for a repository path.
removeTypeDescriptor ( string $typeName ) Removes a type descriptor.
setDependencies ( array $moduleNames ) Sets the names of the modules this module depends on.
setExtraKey ( string $key, mixed $value ) Sets an extra key in the module file.
setExtraKeys ( array $values ) Sets multiple extra keys at once.
setModuleName ( string | null $moduleName ) Sets the module name.
setVersion ( string $version ) Sets the version of the module file.

Method Details

__construct() public method

Creates a new module file.
public __construct ( string | null $moduleName = null, string | null $path = null )
$moduleName string | null The module name. Optional.
$path string | null The path where the file is stored or `null` if this configuration is not stored on the file system.

addBindingDescriptor() public method

Adds a binding descriptor.
public addBindingDescriptor ( Puli\Manager\Api\Discovery\BindingDescriptor $descriptor )
$descriptor Puli\Manager\Api\Discovery\BindingDescriptor The binding descriptor to add.

addDependency() public method

Adds a dependency to a module.
public addDependency ( string $moduleName )
$moduleName string The name of the module.

addExtraKeys() public method

Existing extra keys are preserved.
See also: setExtraKey()
public addExtraKeys ( array $values )
$values array The values indexed by their key names.

addPathMapping() public method

Adds a path mapping.
public addPathMapping ( PathMapping $mapping )
$mapping Puli\Manager\Api\Repository\PathMapping The path mapping.

addTypeDescriptor() public method

Adds a type descriptor.
public addTypeDescriptor ( Puli\Manager\Api\Discovery\BindingTypeDescriptor $descriptor )
$descriptor Puli\Manager\Api\Discovery\BindingTypeDescriptor The type descriptor.

clearBindingDescriptors() public method

Removes all binding descriptors.

clearDependencies() public method

Removes all dependencies.
public clearDependencies ( )

clearExtraKeys() public method

Removes all extra keys.
See also: setExtraKey()
public clearExtraKeys ( )

clearPathMappings() public method

Removes all path mappings.
public clearPathMappings ( )

clearTypeDescriptors() public method

Removes all type descriptors.

getBindingDescriptor() public method

Returns the binding descriptor with the given UUID.
public getBindingDescriptor ( Rhumsaa\Uuid\Uuid $uuid ) : Puli\Manager\Api\Discovery\BindingDescriptor
$uuid Rhumsaa\Uuid\Uuid The UUID of the binding descriptor.
return Puli\Manager\Api\Discovery\BindingDescriptor The binding descriptor.

getBindingDescriptors() public method

Returns the binding descriptors.
public getBindingDescriptors ( ) : Puli\Manager\Api\Discovery\BindingDescriptor[]
return Puli\Manager\Api\Discovery\BindingDescriptor[] The binding descriptors.

getDependencies() public method

Returns the names of the modules this module overrides.
public getDependencies ( ) : string[]
return string[] The names of the overridden modules.

getExtraKey() public method

Returns the value of an extra key.
See also: setExtraKey()
public getExtraKey ( string $key, mixed $default = null ) : mixed
$key string The name of the key.
$default mixed The value to return if the key was not set.
return mixed The value stored for the key.

getExtraKeys() public method

Returns all stored extra keys.
See also: setExtraKey()
public getExtraKeys ( ) : array
return array The stored values indexed by their key names.

getModuleName() public method

Returns the module name.
public getModuleName ( ) : string | null
return string | null The module name or `null` if none is set.

getPath() public method

Returns the path to the module file.
public getPath ( ) : string | null
return string | null The path or `null` if this file is not stored on the file system.

getPathMapping() public method

Returns the path mapping for a repository path.
public getPathMapping ( string $repositoryPath ) : PathMapping
$repositoryPath string The repository path.
return Puli\Manager\Api\Repository\PathMapping The corresponding path mapping.

getPathMappings() public method

Returns the path mappings.
public getPathMappings ( ) : PathMapping[]
return Puli\Manager\Api\Repository\PathMapping[] The path mappings.

getTypeDescriptor() public method

Returns the type descriptor with the given name.
public getTypeDescriptor ( string $typeName ) : Puli\Manager\Api\Discovery\BindingTypeDescriptor
$typeName string The type name.
return Puli\Manager\Api\Discovery\BindingTypeDescriptor The type descriptor.

getTypeDescriptors() public method

Returns the type descriptors.
public getTypeDescriptors ( ) : Puli\Manager\Api\Discovery\BindingTypeDescriptor[]
return Puli\Manager\Api\Discovery\BindingTypeDescriptor[] The type descriptors.

getVersion() public method

Returns the version of the module file.
public getVersion ( ) : string
return string The module file version.

hasBindingDescriptor() public method

Returns whether the binding descriptor exists in this file.
public hasBindingDescriptor ( Rhumsaa\Uuid\Uuid $uuid ) : boolean
$uuid Rhumsaa\Uuid\Uuid The UUID of the binding descriptor.
return boolean Whether the file contains the binding descriptor.

hasBindingDescriptors() public method

Returns whether the file contains any binding descriptors.
public hasBindingDescriptors ( ) : boolean
return boolean Returns `true` if the file contains binding descriptors and `false` otherwise.

hasDependencies() public method

Returns whether the module has dependencies on other modules.
public hasDependencies ( ) : boolean
return boolean Returns `true` if the module depends on other modules and `false` otherwise.

hasDependency() public method

Returns whether the module depends on a given module.
public hasDependency ( string $moduleName ) : boolean
$moduleName string The name of the module.
return boolean Returns `true` if the module depends on the given module.

hasExtraKey() public method

Returns whether the given extra key exists.
See also: setExtraKey()
public hasExtraKey ( string $key ) : boolean
$key string The name of the key.
return boolean Returns `true` if the given extra key exists and `false` otherwise.

hasExtraKeys() public method

Returns whether the file contains any extra keys.
See also: setExtraKey()
public hasExtraKeys ( ) : boolean
return boolean Returns `true` if the file contains extra keys and `false` otherwise.

hasPathMapping() public method

Returns whether the file contains a path mapping for a repository path.
public hasPathMapping ( string $repositoryPath ) : boolean
$repositoryPath string The repository path.
return boolean Returns `true` if the file contains a mapping for the path.

hasPathMappings() public method

Returns whether the file contains any path mappings.
public hasPathMappings ( ) : boolean
return boolean Returns `true` if the file contains path mappings and `false` otherwise.

hasTypeDescriptor() public method

Returns whether a type is defined in this file.
public hasTypeDescriptor ( string $typeName ) : boolean
$typeName string The type name.
return boolean Whether the type is defined in the file.

hasTypeDescriptors() public method

Returns whether the file contains any type descriptors.
public hasTypeDescriptors ( ) : boolean
return boolean Returns `true` if the file contains type descriptors and `false` otherwise.

removeBindingDescriptor() public method

Removes a binding descriptor.
public removeBindingDescriptor ( Rhumsaa\Uuid\Uuid $uuid )
$uuid Rhumsaa\Uuid\Uuid The UUID of the binding descriptor to remove.

removeDependency() public method

Adds a dependency to a module.
public removeDependency ( string $moduleName )
$moduleName string The name of the module.

removeExtraKey() public method

Removes an extra key.
See also: setExtraKey()
public removeExtraKey ( string $key )
$key string The name of the key.

removePathMapping() public method

Removes the path mapping for a repository path.
public removePathMapping ( string $repositoryPath )
$repositoryPath string The repository path.

removeTypeDescriptor() public method

Removes a type descriptor.
public removeTypeDescriptor ( string $typeName )
$typeName string The type name.

setDependencies() public method

Sets the names of the modules this module depends on.
public setDependencies ( array $moduleNames )
$moduleNames array The names of the modules.

setExtraKey() public method

Extra keys can be freely set by the user. They are stored in a separate area of the module file and not validated in any way.
public setExtraKey ( string $key, mixed $value )
$key string The name of the key.
$value mixed The value to store.

setExtraKeys() public method

Existing extra keys are overridden.
See also: setExtraKey()
public setExtraKeys ( array $values )
$values array The values indexed by their key names.

setModuleName() public method

Sets the module name.
public setModuleName ( string | null $moduleName )
$moduleName string | null The module name or `null` to unset.

setVersion() public method

Sets the version of the module file.
public setVersion ( string $version )
$version string The module file version.