class container_builder

Properties

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

The container under construction

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
protected driver_interface $dbal_connection

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 277
$this with_environment(string $environment)

Enable the extensions.

Parameters

string $environment

The environment to use

Return Value

$this

at line 289
$this with_extensions()

Enable the extensions.

Return Value

$this

at line 301
$this without_extensions()

Disable the extensions.

Return Value

$this

at line 315
$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 327
$this without_cache()

Disable the caching of the container.

Return Value

$this

at line 340
$this with_cache_dir(string $cache_dir)

Set the cache directory.

Parameters

string $cache_dir

The cache directory.

Return Value

$this

at line 352
$this with_compiled_container()

Enable the compilation of the container.

Return Value

$this

at line 364
$this without_compiled_container()

Disable the compilation of the container.

Return Value

$this

at line 377
$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 390
$this with_custom_parameters(array $custom_parameters)

Set custom parameters to inject into the container.

Parameters

array $custom_parameters

Return Value

$this

at line 403
$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 415
protected string get_config_path()

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

Return Value

string

at line 425
protected 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 433
protected load_extensions()

Load the enabled extensions.

at line 507
protected dump_container(ConfigCache $cache)

Dump the container to the disk.

Parameters

ConfigCache $cache

The config cache

at line 534
protected ContainerBuilder create_container(array $extensions)

Create the ContainerBuilder object

Parameters

array $extensions

Array of Container extension objects

Return Value

ContainerBuilder

object

at line 555
protected inject_custom_parameters()

Inject the customs parameters into the container

at line 566
protected inject_dbal_driver()

Inject the dbal connection driver into container

at line 600
protected array get_core_parameters()

Returns the core parameters.

Return Value

array

An array of core parameters

at line 621
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 640
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 656
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 672
protected string get_environment()

Return the name of the current environment.

Return Value

string