HumHub Documentation (unofficial)

ModuleContainer
in package

Class ModuleContainer

Table of Contents

Constants

MAXIMUM_LEVENSHTEIN_DISTANCE  = 5
MODULE_NAMESPACE  = '\Codeception\Module\\'

Properties

$packages  : mixed
$actions  : array<string|int, mixed>
$active  : array<string|int, mixed>
$config  : array<string|int, mixed>
$di  : Di
$modules  : array<string|int, mixed>

Methods

__construct()  : mixed
Constructor.
all()  : array<string|int, mixed>
Get all modules.
create()  : Module
Create a module.
getActions()  : array<string|int, mixed>
Get all actions.
getModule()  : Module
Get a module from this ModuleContainer.
hasModule()  : bool
Is a module instantiated in this ModuleContainer?
mock()  : mixed
Mock a module in this ModuleContainer.
moduleForAction()  : Module|null
Get the module for an action.
throwMissingModuleExceptionWithSuggestion()  : mixed
validateConflicts()  : mixed
Check if there are conflicting modules in this ModuleContainer.
getModuleSuggestion()  : mixed
checkForMissingDependencies()  : mixed
Check for missing dependencies.
getActionsForModule()  : array<string|int, mixed>
Get the actions of a module.
getConfiguredDependencies()  : array<string|int, mixed>
Get the configured dependencies for a module.
getErrorMessageForDependency()  : string
Get the error message for a module dependency that is missing.
getModuleClass()  : string
Get the fully qualified class name for a module.
getModuleConfig()  : array<string|int, mixed>
Get the configuration for a module.
getModuleDependencies()  : array<string|int, mixed>
Get the dependencies of a module.
includeMethodAsAction()  : bool
Should a method be included as an action?
injectModuleDependencies()  : mixed
Inject the dependencies of a module.
isHelper()  : bool
Is the module a helper?
moduleHasDependencies()  : bool
Does a module have dependencies?
normalizeConflictSpecification()  : string
Normalize the return value of ConflictsWithModule::_conflicts() to a class name.
validateConflict()  : mixed
Check if the modules passed as arguments to this method conflict with each other.

Constants

MAXIMUM_LEVENSHTEIN_DISTANCE

public int MAXIMUM_LEVENSHTEIN_DISTANCE = 5

MODULE_NAMESPACE

public string MODULE_NAMESPACE = '\Codeception\Module\\'

Properties

$packages

public static mixed $packages = ['AMQP' => 'codeception/module-amqp', 'Apc' => 'codeception/module-apc', 'Asserts' => 'codeception/module-asserts', 'Cli' => 'codeception/module-cli', 'DataFactory' => 'codeception/module-datafactory', 'Db' => 'codeception/module-db', 'Doctrine2' => "codeception/module-doctrine2", 'Filesystem' => 'codeception/module-filesystem', 'FTP' => 'codeception/module-ftp', 'Laravel5' => 'codeception/module-laravel5', 'Lumen' => 'codeception/module-lumen', 'Memcache' => 'codeception/module-memcache', 'MongoDb' => 'codeception/module-mongodb', 'Phalcon' => 'codeception/module-phalcon', 'PhpBrowser' => 'codeception/module-phpbrowser', 'Queue' => 'codeception/module-queue', 'Redis' => 'codeception/module-redis', 'REST' => 'codeception/module-rest', 'Sequence' => 'codeception/module-sequence', 'SOAP' => 'codeception/module-soap', 'Symfony' => 'codeception/module-symfony', 'WebDriver' => "codeception/module-webdriver", 'Yii2' => "codeception/module-yii2", 'ZendExpressive' => 'codeception/module-zendexpressive', 'ZF2' => 'codeception/module-zf2']

Methods

__construct()

Constructor.

public __construct(Di $di, array<string|int, mixed> $config) : mixed
Parameters
$di : Di
$config : array<string|int, mixed>

all()

Get all modules.

public all() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array with module names as keys and modules as values.

getActions()

Get all actions.

public getActions() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array with actions as keys and module names as values.

hasModule()

Is a module instantiated in this ModuleContainer?

public hasModule(string $moduleName) : bool
Parameters
$moduleName : string
Return values
bool

mock()

Mock a module in this ModuleContainer.

public mock(string $moduleName, object $mock) : mixed
Parameters
$moduleName : string
$mock : object

moduleForAction()

Get the module for an action.

public moduleForAction(string $action) : Module|null
Parameters
$action : string
Return values
Module|null

This method returns null if there is no module for $action

throwMissingModuleExceptionWithSuggestion()

public throwMissingModuleExceptionWithSuggestion(mixed $className, mixed $moduleName) : mixed
Parameters
$className : mixed
$moduleName : mixed

getModuleSuggestion()

protected getModuleSuggestion(mixed $missingModuleName) : mixed
Parameters
$missingModuleName : mixed

getActionsForModule()

Get the actions of a module.

private getActionsForModule(Module $module, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
$module : Module
$config : array<string|int, mixed>
Return values
array<string|int, mixed>

getConfiguredDependencies()

Get the configured dependencies for a module.

private getConfiguredDependencies(string $moduleName) : array<string|int, mixed>
Parameters
$moduleName : string
Return values
array<string|int, mixed>

getErrorMessageForDependency()

Get the error message for a module dependency that is missing.

private getErrorMessageForDependency(Module $module, string $missingDependency) : string
Parameters
$module : Module
$missingDependency : string
Return values
string

getModuleClass()

Get the fully qualified class name for a module.

private getModuleClass(string $moduleName) : string
Parameters
$moduleName : string
Return values
string

getModuleConfig()

Get the configuration for a module.

private getModuleConfig(string $moduleName) : array<string|int, mixed>

A module with name $moduleName can be configured at two paths in a configuration file:

  • modules.config.$moduleName
  • modules.enabled.$moduleName

This method checks both locations for configuration. If there is configuration at both locations this method merges them, where the configuration at modules.enabled.$moduleName takes precedence over modules.config.$moduleName if the same parameters are configured at both locations.

Parameters
$moduleName : string
Return values
array<string|int, mixed>

includeMethodAsAction()

Should a method be included as an action?

private includeMethodAsAction(Module $module, ReflectionMethod $method[, array<string|int, mixed>|null $configuredParts = null ]) : bool
Parameters
$module : Module
$method : ReflectionMethod
$configuredParts : array<string|int, mixed>|null = null
Return values
bool

isHelper()

Is the module a helper?

private isHelper(string $moduleName) : bool
Parameters
$moduleName : string
Return values
bool

moduleHasDependencies()

Does a module have dependencies?

private moduleHasDependencies(Module $module) : bool
Parameters
$module : Module
Return values
bool

normalizeConflictSpecification()

Normalize the return value of ConflictsWithModule::_conflicts() to a class name.

private normalizeConflictSpecification(string $conflicts) : string

This is necessary because it can return a module name instead of the name of a class or interface.

Parameters
$conflicts : string
Return values
string

        
On this page

Search results