class IniFileLoader in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php \Symfony\Component\DependencyInjection\Loader\IniFileLoader
IniFileLoader loads parameters from INI files.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\DependencyInjection\Loader\FileLoader extends \Symfony\Component\Config\Loader\FileLoader
- class \Symfony\Component\DependencyInjection\Loader\IniFileLoader
Expanded class hierarchy of IniFileLoader
3 files declare their use of IniFileLoader
- IniFileLoaderTest.php in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ IniFileLoaderTest.php - XmlFileLoaderTest.php in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ XmlFileLoaderTest.php - YamlFileLoaderTest.php in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ YamlFileLoaderTest.php
1 string reference to 'IniFileLoader'
- services4.yml in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Fixtures/ yaml/ services4.yml - modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Loader/ IniFileLoader.php, line 22
Namespace
Symfony\Component\DependencyInjection\LoaderView source
class IniFileLoader extends FileLoader {
/**
* {@inheritdoc}
*/
public function load($resource, $type = null) {
$path = $this->locator
->locate($resource);
$this->container
->addResource(new FileResource($path));
$result = parse_ini_file($path, true);
if (false === $result || array() === $result) {
throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource));
}
if (isset($result['parameters']) && is_array($result['parameters'])) {
foreach ($result['parameters'] as $key => $value) {
$this->container
->setParameter($key, $value);
}
}
}
/**
* {@inheritdoc}
*/
public function supports($resource, $type = null) {
return is_string($resource) && 'ini' === pathinfo($resource, PATHINFO_EXTENSION);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileLoader:: |
protected | property | ||
FileLoader:: |
public | function | Constructor. | |
IniFileLoader:: |
public | function | ||
IniFileLoader:: |
public | function |