PHP Class FOF30\Container\Container

The properties below (except componentName, bareComponentName and the ones marked with property-read) can be configured in the fof.xml component configuration file. Sample fof.xml: The paths can use the variables %ROOT%, %PUBLIC%, %ADMIN%, %TMP%, %LOG% i.e. all the path keys returned by Platform's getPlatformBaseDirs() method in uppercase and surrounded by percent signs.
Inheritance: extends ContainerBase
Show file Open project: akeeba/fof Class Usage Examples

Protected Properties

Property Type Description
$instances array Cache of created container instances

Public Methods

Method Description
__construct ( array $values = [] ) Public constructor. This does NOT go through the fof.xml file. You are advised to use getInstance() instead.
getInstance ( string $component, array $values = [], string $section = 'auto' ) : Container Returns a container instance for a specific component. This method goes through fof.xml to read the default configuration values for the container. You are advised to use this unless you have a specific reason for instantiating a Container without going through the fof.xml file.
getNamespacePrefix ( string $section = 'auto' ) : string Get the applicable namespace prefix for a component section. Possible sections: auto Auto-detect which is the current component section inverse The inverse area than auto site Frontend admin Backend
parsePathVariables ( $path )

Protected Methods

Method Description
getDefaultMediaVersion ( ) : string Gets the default media version string for the component using the component's version and date, as well as the site's secret key.
makeInstance ( string $component, array $values = [], string $section = 'auto' ) : Container Returns a temporary container instance for a specific component.

Method Details

__construct() public method

Public constructor. This does NOT go through the fof.xml file. You are advised to use getInstance() instead.
public __construct ( array $values = [] )
$values array Overrides for the container configuration and services

getDefaultMediaVersion() protected method

Gets the default media version string for the component using the component's version and date, as well as the site's secret key.
protected getDefaultMediaVersion ( ) : string
return string

getInstance() public static method

Pass the value 'tempInstance' => true in the $values array to get a temporary instance. Otherwise you will get the cached instance of the previously created container.
public static getInstance ( string $component, array $values = [], string $section = 'auto' ) : Container
$component string The component you want to get a container for, e.g. com_foobar.
$values array Container configuration overrides you want to apply. Optional.
$section string The application section (site, admin) you want to fetch. Any other value results in auto-detection.
return Container

getNamespacePrefix() public method

Get the applicable namespace prefix for a component section. Possible sections: auto Auto-detect which is the current component section inverse The inverse area than auto site Frontend admin Backend
public getNamespacePrefix ( string $section = 'auto' ) : string
$section string The section you want to get information for
return string The namespace prefix for the component's classes, e.g. \Foobar\Example\Site\

makeInstance() protected static method

Returns a temporary container instance for a specific component.
protected static makeInstance ( string $component, array $values = [], string $section = 'auto' ) : Container
$component string The component you want to get a container for, e.g. com_foobar.
$values array Container configuration overrides you want to apply. Optional.
$section string The application section (site, admin) you want to fetch. Any other value results in auto-detection.
return Container

parsePathVariables() public method

public parsePathVariables ( $path )

Property Details

$instances protected static property

Cache of created container instances
protected static array $instances
return array