api/symfony/Component/DependencyInjection/Loader/IniFileLoader.yaml
2024-09-26 02:03:21 -07:00

45 lines
2.4 KiB
YAML

name: IniFileLoader
class_comment: '# * IniFileLoader loads parameters from INI files.
# *
# * @author Fabien Potencier <fabien@symfony.com>'
dependencies:
- name: XmlUtils
type: class
source: Symfony\Component\Config\Util\XmlUtils
- name: InvalidArgumentException
type: class
source: Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
properties: []
methods:
- name: phpize
visibility: private
parameters:
- name: value
comment: "# * IniFileLoader loads parameters from INI files.\n# *\n# * @author Fabien\
\ Potencier <fabien@symfony.com>\n# */\n# class IniFileLoader extends FileLoader\n\
# {\n# public function load(mixed $resource, ?string $type = null): mixed\n# {\n\
# $path = $this->locator->locate($resource);\n# \n# $this->container->fileExists($path);\n\
# \n# // first pass to catch parsing errors\n# $result = parse_ini_file($path,\
\ true);\n# if (false === $result || [] === $result) {\n# throw new InvalidArgumentException(\\\
sprintf('The \"%s\" file is not valid.', $resource));\n# }\n# \n# // real raw\
\ parsing\n# $result = parse_ini_file($path, true, \\INI_SCANNER_RAW);\n# \n#\
\ if (isset($result['parameters']) && \\is_array($result['parameters'])) {\n#\
\ foreach ($result['parameters'] as $key => $value) {\n# if (\\is_array($value))\
\ {\n# $this->container->setParameter($key, array_map($this->phpize(...), $value));\n\
# } else {\n# $this->container->setParameter($key, $this->phpize($value));\n#\
\ }\n# }\n# }\n# \n# if ($this->env && \\is_array($result['parameters@'.$this->env]\
\ ?? null)) {\n# foreach ($result['parameters@'.$this->env] as $key => $value)\
\ {\n# $this->container->setParameter($key, $this->phpize($value));\n# }\n# }\n\
# \n# return null;\n# }\n# \n# public function supports(mixed $resource, ?string\
\ $type = null): bool\n# {\n# if (!\\is_string($resource)) {\n# return false;\n\
# }\n# \n# if (null === $type && 'ini' === pathinfo($resource, \\PATHINFO_EXTENSION))\
\ {\n# return true;\n# }\n# \n# return 'ini' === $type;\n# }\n# \n# /**\n# * Note\
\ that the following features are not supported:\n# * * strings with escaped\
\ quotes are not supported \"foo\\\"bar\";\n# * * string concatenation (\"foo\"\
\ \"bar\")."
traits:
- Symfony\Component\Config\Util\XmlUtils
- Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
interfaces: []