public static
string
|
#
format_model_name( string $module_id, string $model_id = 'primary' )
Formats a SQL table name given the module id and the model id.
Formats a SQL table name given the module id and the model id.
Parameters
- $module_id
string $module_id
- $model_id
string $model_id
Returns
string
|
public
|
#
__construct( array $paths, ICanBoogie\Vars $cache = null )
The index for the available modules is created with the accessor object.
The index for the available modules is created with the accessor object.
Parameters
- $paths
array $paths The paths to look for modules.
- $cache
ICanBoogie\Vars
$cache The cache to use for the module indexes.
|
protected
|
#
revoke_constructions( )
Revokes constructions.
The following properties are revoked:
- $enabled_modules_descriptors
- $disabled_modules_descriptors
- $catalog_paths
- $config_paths
The method is usually invoked when modules state changes, in order to reflect
these changes.
|
public
|
#
enable( string $id )
Enables a module.
Parameters
- $id
string $id Identifier of the module.
|
public
|
#
disable( string $id )
Disables a module.
Parameters
- $id
string $id Identifier of the module.
|
public
|
#
offsetSet( mixed $id, mixed $enable )
Used to enable or disable a module using the specified offset as the module's
id.
Used to enable or disable a module using the specified offset as the module's
id.
The module is enabled or disabled by modifying the value of the ICanBoogie\Module::T_DISABLED key of the module's descriptor.
Parameters
- $id
mixed $id Identifier of the module.
- $enable
mixed $enable Status of the module: true for enabled, false
for disabled.
Implementation of
|
public
boolean
|
#
offsetExists( string $id )
Checks the availability of a module.
Checks the availability of a module.
A module is considered available when its descriptor is defined, and the
ICanBoogie\Module::T_DISABLED key of its descriptor is empty.
Note: empty() will call ICanBoogie\Modules::offsetGet() to check if the
value is not empty. So, unless you want to use the module you check, better
check using !isset() , otherwise the module you check is loaded
too.
Parameters
- $id
string $id Identifier of the module.
Returns
boolean Whether or not the module is available.
Implementation of
|
public
|
#
offsetUnset( string $id )
Disables a module by setting the ICanBoogie\Module::T_DISABLED key of its
descriptor to true .
The method also dismisses the enabled_modules_descriptors and disabled_modules_descriptors properties.
Parameters
- $id
string $id Identifier of the module.
Implementation of
|
public
ICanBoogie\Module
|
#
offsetGet( string $id )
Returns a module object.
If the autorun property is true , the Module::run() method of the module is invoked upon its first loading.
Parameters
- $id
string $id The identifier of the module.
Returns
Throws
Implementation of
|
public
ArrayIterator
|
#
getIterator( )
Returns an iterator for the modules.
Returns an iterator for the modules.
Returns
Implementation of
|
protected
array
|
#
lazy_get_index( )
Indexes the modules found in the paths specified during construct.
Indexes the modules found in the paths specified during construct.
The index is made of an array of descriptors, an array of catalogs paths, an
array of configs path, and finally an array of configs constructors.
The method also creates a DIR constant for each module. The
constant is defined in the namespace of the module e.g.
Icybee\Modules\Nodes\DIR .
Returns
array
|
protected
array
|
#
index_construct( )
Construct the index for the modules.
Construct the index for the modules.
The index contains the following values:
- (array) descriptors: The descriptors of the modules, ordered by weight.
- (array) catalogs: Absolute paths to locale catalog directories.
- (array) configs: Absolute paths to config directories.
- (array) classes aliases: An array of _key/value_ pairs where _key_ is the
alias of a class
and _value_ if the real class.
Returns
array
|
protected
array[string]array
|
#
index_descriptors( array $paths )
Indexes descriptors.
The descriptors are extended with the following default values:
- (string) category: null.
- (string) class: Modules\<normalized_module_part>
- (string) description: null.
- (bool) disabled: false if required, true otherwise.
- (string) extends: null.
- (string) id: The module's identifier.
- (array) models: Empty array.
- (string) path: The absolute path to the module directory.
- (string) permission: null.
- (array) permissions: Empty array.
- (bool) startup: false.
- (bool) required: false.
- (array) requires: Empty array.
- (string) weight: 0.
The descriptors are ordered according to their inheritance and weight.
Parameters
Returns
array[string]array
Throws
|
protected
|
|
protected
array
|
#
read_descriptor( string $id, string $path )
Reads the descriptor file.
Reads the descriptor file.
The descriptor file is extended with private values and default values.
Parameters
- $id
string $id The identifier of the module.
- $path
string $path The path to the directory where the descriptor is located.
Returns
array
Throws
InvalidArgumentException
in the following situations: - The descriptor is not an array - The T_TITLE key is empty. - The T_NAMESPACE key is empty.
|
protected
array
|
#
alter_descriptor( array $descriptor )
Alters the module descriptor.
Alters the module descriptor.
Parameters
- $descriptor
array $descriptor Descriptor of the module to index.
Returns
array The altered descriptor.
|
protected
array
|
#
lazy_get_disabled_modules_descriptors( )
Returns the descriptors of the disabled modules.
Returns the descriptors of the disabled modules.
This method is the getter for the $disabled_modules_descriptors magic
property.
Returns
array
|
protected
array
|
#
lazy_get_enabled_modules_descriptors( )
Returns the descriptors of the enabled modules.
Returns the descriptors of the enabled modules.
This method is the getter for the $enabled_modules_descriptors magic
property.
Returns
array
|
protected
array[]string
|
#
lazy_get_locale_paths( )
Returns the paths of the enabled modules which have a locale
folder.
Returns the paths of the enabled modules which have a locale
folder.
Returns
array[]string
|
protected
array[]string
|
#
lazy_get_config_paths( )
Returns the paths of the enabled modules which have a config
folder.
Returns the paths of the enabled modules which have a config
folder.
Returns
array[]string
|
public
array
|
#
order_ids( array $ids, array $descriptors = null )
Orders the module ids provided according to module inheritance and
weight.
Orders the module ids provided according to module inheritance and
weight.
Parameters
- $ids
array $ids The module ids to order.
- $descriptors
array $descriptors Module descriptors.
Returns
array
|
public
integer
|
#
usage( string $module_id, boolean $all = false )
Returns the usage of a module by other modules.
Returns the usage of a module by other modules.
Parameters
- $module_id
string $module_id The identifier of the module.
- $all
boolean $all The usage is only computed for enabled module, this parameter can be used
to compute the usage with disabled modules also.
Returns
integer
|
public
boolean
|
#
is_extending( string $module_id, string $extending_id )
Checks if a module extends another.
Checks if a module extends another.
Parameters
- $module_id
string $module_id Module identifier.
- $extending_id
string $extending_id Identifier of the extended module.
Returns
boolean
true if the module extends the other.
|