api/symfony/Component/DependencyInjection/ParameterBag/ParameterBag.yaml

148 lines
5.6 KiB
YAML
Raw Normal View History

2024-09-26 09:03:21 +00:00
name: ParameterBag
class_comment: '# * Holds parameters.
# *
# * @author Fabien Potencier <fabien@symfony.com>'
dependencies:
- name: InvalidArgumentException
type: class
source: Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- name: ParameterCircularReferenceException
type: class
source: Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException
- name: ParameterNotFoundException
type: class
source: Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
- name: RuntimeException
type: class
source: Symfony\Component\DependencyInjection\Exception\RuntimeException
properties: []
methods:
- name: deprecate
visibility: public
parameters:
- name: name
- name: package
- name: version
- name: message
default: '''The parameter "%s" is deprecated.'''
comment: "# * Holds parameters.\n# *\n# * @author Fabien Potencier <fabien@symfony.com>\n\
# */\n# class ParameterBag implements ParameterBagInterface\n# {\n# protected\
\ array $parameters = [];\n# protected bool $resolved = false;\n# protected array\
\ $deprecatedParameters = [];\n# \n# public function __construct(array $parameters\
\ = [])\n# {\n# $this->add($parameters);\n# }\n# \n# public function clear():\
\ void\n# {\n# $this->parameters = [];\n# }\n# \n# public function add(array $parameters):\
\ void\n# {\n# foreach ($parameters as $key => $value) {\n# $this->set($key, $value);\n\
# }\n# }\n# \n# public function all(): array\n# {\n# return $this->parameters;\n\
# }\n# \n# public function allDeprecated(): array\n# {\n# return $this->deprecatedParameters;\n\
# }\n# \n# public function get(string $name): array|bool|string|int|float|\\UnitEnum|null\n\
# {\n# if (!\\array_key_exists($name, $this->parameters)) {\n# if (!$name) {\n\
# throw new ParameterNotFoundException($name);\n# }\n# \n# $alternatives = [];\n\
# foreach ($this->parameters as $key => $parameterValue) {\n# $lev = levenshtein($name,\
\ $key);\n# if ($lev <= \\strlen($name) / 3 || str_contains($key, $name)) {\n\
# $alternatives[] = $key;\n# }\n# }\n# \n# $nonNestedAlternative = null;\n# if\
\ (!\\count($alternatives) && str_contains($name, '.')) {\n# $namePartsLength\
\ = array_map('strlen', explode('.', $name));\n# $key = substr($name, 0, -1 *\
\ (1 + array_pop($namePartsLength)));\n# while (\\count($namePartsLength)) {\n\
# if ($this->has($key)) {\n# if (\\is_array($this->get($key))) {\n# $nonNestedAlternative\
\ = $key;\n# }\n# break;\n# }\n# \n# $key = substr($key, 0, -1 * (1 + array_pop($namePartsLength)));\n\
# }\n# }\n# \n# throw new ParameterNotFoundException($name, null, null, null,\
\ $alternatives, $nonNestedAlternative);\n# }\n# \n# if (isset($this->deprecatedParameters[$name]))\
\ {\n# trigger_deprecation(...$this->deprecatedParameters[$name]);\n# }\n# \n\
# return $this->parameters[$name];\n# }\n# \n# public function set(string $name,\
\ array|bool|string|int|float|\\UnitEnum|null $value): void\n# {\n# if (is_numeric($name))\
\ {\n# throw new InvalidArgumentException(\\sprintf('The parameter name \"%s\"\
\ cannot be numeric.', $name));\n# }\n# \n# $this->parameters[$name] = $value;\n\
# }\n# \n# /**\n# * Deprecates a service container parameter.\n# *\n# * @throws\
\ ParameterNotFoundException if the parameter is not defined"
- name: has
visibility: public
parameters:
- name: name
comment: null
- name: remove
visibility: public
parameters:
- name: name
comment: null
- name: resolve
visibility: public
parameters: []
comment: null
- name: resolveValue
visibility: public
parameters:
- name: value
- name: resolving
default: '[]'
comment: '# * Replaces parameter placeholders (%name%) by their values.
# *
# * @template TValue of array<array|scalar>|scalar
# *
# * @param TValue $value
# * @param array $resolving An array of keys that are being resolved (used internally
to detect circular references)
# *
# * @psalm-return (TValue is scalar ? array|scalar : array<array|scalar>)
# *
# * @throws ParameterNotFoundException if a placeholder references a
parameter that does not exist
# * @throws ParameterCircularReferenceException if a circular reference if detected
# * @throws RuntimeException when a given parameter has a type
problem'
- name: resolveString
visibility: public
parameters:
- name: value
- name: resolving
default: '[]'
comment: '# * Resolves parameters inside a string.
# *
# * @param array $resolving An array of keys that are being resolved (used internally
to detect circular references)
# *
# * @throws ParameterNotFoundException if a placeholder references a
parameter that does not exist
# * @throws ParameterCircularReferenceException if a circular reference if detected
# * @throws RuntimeException when a given parameter has a type
problem'
- name: isResolved
visibility: public
parameters: []
comment: null
- name: escapeValue
visibility: public
parameters:
- name: value
comment: null
- name: unescapeValue
visibility: public
parameters:
- name: value
comment: null
traits:
- Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
- Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException
- Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
- Symfony\Component\DependencyInjection\Exception\RuntimeException
interfaces:
- ParameterBagInterface