class container_builder

Properties

protected string $environment
protected string $phpbb_root_path
protected string $php_ext
protected ContainerBuilder $container

The container under construction

protected driver_interface $dbal_connection
protected bool $use_extensions

Indicates whether extensions should be used (default to true).

protected string $config_path

Defines a custom path to find the configuration of the container (default to $this->phpbb_root_path . 'config')

protected bool $use_cache

Indicates whether the container should be dumped to the filesystem (default to true).

protected bool $compile_container

Indicates if the container should be compiled automatically (default to true).

protected array $custom_parameters

Custom parameters to inject into the container.

protected config_php_file $config_php_file
protected string $cache_dir

Methods

__construct(string $phpbb_root_path, string $php_ext)

Constructor

phpbb_cache_container|ContainerBuilder
get_container()

Build and return a new Container respecting the current configuration

$this
with_environment(string $environment)

Enable the extensions.

$this
with_extensions()

Enable the extensions.

$this
without_extensions()

Disable the extensions.

$this
with_cache()

Enable the caching of the container.

$this
without_cache()

Disable the caching of the container.

$this
with_cache_dir(string $cache_dir)

Set the cache directory.

$this
with_compiled_container()

Enable the compilation of the container.

$this
without_compiled_container()

Disable the compilation of the container.

$this
with_config_path(string $config_path)

Set a custom path to find the configuration of the container.

$this
with_custom_parameters(array $custom_parameters)

Set custom parameters to inject into the container.

$this
with_config(config_php_file $config_php_file)

Set custom parameters to inject into the container.

string
get_config_path()

Returns the path to the container configuration (default: root_path/config)

string
get_cache_dir()

Returns the path to the cache directory (default: root_path/cache/environment).

load_extensions()

Load the enabled extensions.

dump_container(ConfigCache $cache)

Dump the container to the disk.

ContainerBuilder
create_container(array $extensions)

Create the ContainerBuilder object

inject_custom_parameters()

Inject the customs parameters into the container

inject_dbal_driver()

Inject the dbal connection driver into container

array
get_core_parameters()

Returns the core parameters.

array
get_env_parameters()

Gets the environment parameters.

string
get_container_filename()

Get the filename under which the dumped container will be stored.

string
get_autoload_filename()

Get the filename under which the dumped extensions autoloader will be stored.

string
get_environment()

Return the name of the current environment.

Details

at line 130
__construct(string $phpbb_root_path, string $php_ext)

Constructor

Parameters

string $phpbb_root_path

Path to the phpbb includes directory.

string $php_ext

php file extension

at line 147
phpbb_cache_container|ContainerBuilder get_container()

Build and return a new Container respecting the current configuration

Return Value

phpbb_cache_container|ContainerBuilder

at line 275
$this with_environment(string $environment)

Enable the extensions.

Parameters

string $environment

The environment to use

Return Value

$this

at line 287
$this with_extensions()

Enable the extensions.

Return Value

$this

at line 299
$this without_extensions()

Disable the extensions.

Return Value

$this

at line 313
$this with_cache()

Enable the caching of the container.

If DEBUG_CONTAINER is set this option is ignored and a new container is build.

Return Value

$this

at line 325
$this without_cache()

Disable the caching of the container.

Return Value

$this

at line 338
$this with_cache_dir(string $cache_dir)

Set the cache directory.

Parameters

string $cache_dir

The cache directory.

Return Value

$this

at line 350
$this with_compiled_container()

Enable the compilation of the container.

Return Value

$this

at line 362
$this without_compiled_container()

Disable the compilation of the container.

Return Value

$this

at line 375
$this with_config_path(string $config_path)

Set a custom path to find the configuration of the container.

Parameters

string $config_path

Return Value

$this

at line 388
$this with_custom_parameters(array $custom_parameters)

Set custom parameters to inject into the container.

Parameters

array $custom_parameters

Return Value

$this

at line 401
$this with_config(config_php_file $config_php_file)

Set custom parameters to inject into the container.

Parameters

config_php_file $config_php_file

Return Value

$this

at line 413
protected string get_config_path()

Returns the path to the container configuration (default: root_path/config)

Return Value

string

at line 423
string get_cache_dir()

Returns the path to the cache directory (default: root_path/cache/environment).

Return Value

string

Path to the cache directory.

at line 431
protected load_extensions()

Load the enabled extensions.

at line 499
protected dump_container(ConfigCache $cache)

Dump the container to the disk.

Parameters

ConfigCache $cache

The config cache

at line 526
protected ContainerBuilder create_container(array $extensions)

Create the ContainerBuilder object

Parameters

array $extensions

Array of Container extension objects

Return Value

ContainerBuilder object

at line 547
protected inject_custom_parameters()

Inject the customs parameters into the container

at line 558
protected inject_dbal_driver()

Inject the dbal connection driver into container

at line 592
protected array get_core_parameters()

Returns the core parameters.

Return Value

array

An array of core parameters

at line 613
protected array get_env_parameters()

Gets the environment parameters.

Only the parameters starting with "PHPBB__" are considered.

Return Value

array

An array of parameters

at line 632
protected string get_container_filename()

Get the filename under which the dumped container will be stored.

Return Value

string

Path for dumped container

at line 648
protected string get_autoload_filename()

Get the filename under which the dumped extensions autoloader will be stored.

Return Value

string

Path for dumped extensions autoloader

at line 664
protected string get_environment()

Return the name of the current environment.

Return Value

string