PHP Interface Puli\Manager\Api\Module\ModuleManager

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

Public Methods

Method Description
clearModules ( ) Removes all modules.
findModules ( Webmozart\Expression\Expression $expr ) : ModuleList Returns all modules matching the given expression.
getContext ( ) : Puli\Manager\Api\Context\ProjectContext Returns the manager's context.
getModule ( string $name ) : Puli\Manager\Api\Module\Module Returns a module by name.
getModules ( ) : ModuleList Returns all installed modules.
getRootModule ( ) : Puli\Manager\Api\Module\RootModule Returns the root module.
hasModule ( string $name ) : boolean Returns whether the manager has the module with the given name.
hasModules ( Webmozart\Expression\Expression $expr = null ) : boolean Returns whether the manager has any modules.
installModule ( string $installPath, string | null $name = null, string $installerName = InstallInfo::DEFAULT_INSTALLER_NAME, string $env = Environment::PROD ) Installs the module at the given path in the repository.
removeModule ( string $name ) Removes the module with the given name.
removeModules ( Webmozart\Expression\Expression $expr ) Removes all modules matching the given expression.
renameModule ( string $name, string $newName ) Renames the module with the given name.

Method Details

clearModules() public method

If matching modules are found, this method does nothing.
public clearModules ( )

findModules() public method

Returns all modules matching the given expression.
public findModules ( Webmozart\Expression\Expression $expr ) : ModuleList
$expr Webmozart\Expression\Expression The search criteria.
return ModuleList The modules matching the expression.

getContext() public method

Returns the manager's context.
public getContext ( ) : Puli\Manager\Api\Context\ProjectContext
return Puli\Manager\Api\Context\ProjectContext The project context.

getModule() public method

Returns a module by name.
public getModule ( string $name ) : Puli\Manager\Api\Module\Module
$name string The module name.
return Puli\Manager\Api\Module\Module The module.

getModules() public method

Returns all installed modules.
public getModules ( ) : ModuleList
return ModuleList The installed modules.

getRootModule() public method

Returns the root module.
public getRootModule ( ) : Puli\Manager\Api\Module\RootModule
return Puli\Manager\Api\Module\RootModule The root module.

hasModule() public method

Returns whether the manager has the module with the given name.
public hasModule ( string $name ) : boolean
$name string The module name.
return boolean Whether the manager has a module with that name.

hasModules() public method

You can optionally pass an expression to check whether the manager has modules matching the expression.
public hasModules ( Webmozart\Expression\Expression $expr = null ) : boolean
$expr Webmozart\Expression\Expression The search criteria.
return boolean Returns `true` if the manager has modules and `false` otherwise. If an expression was passed, this method only returns `true` if the manager has modules matching the expression.

installModule() public method

Installs the module at the given path in the repository.
public installModule ( string $installPath, string | null $name = null, string $installerName = InstallInfo::DEFAULT_INSTALLER_NAME, string $env = Environment::PROD )
$installPath string The path to the module.
$name string | null The module name or `null` if the name should be read from the module's puli.json.
$installerName string The name of the installer.
$env string The environment to install the module in.

removeModule() public method

Removes the module with the given name.
public removeModule ( string $name )
$name string The module name.

removeModules() public method

If no matching modules are found, this method does nothing.
public removeModules ( Webmozart\Expression\Expression $expr )
$expr Webmozart\Expression\Expression The search criteria.

renameModule() public method

Renames the module with the given name.
public renameModule ( string $name, string $newName )
$name string The module name.
$newName string The new module name.