|
| 1 | +<?php |
| 2 | + |
| 3 | +useSymfony\Component\DependencyInjection\Argument\RewindableGenerator; |
| 4 | +useSymfony\Component\DependencyInjection\ContainerInterface; |
| 5 | +useSymfony\Component\DependencyInjection\Container; |
| 6 | +useSymfony\Component\DependencyInjection\Exception\InvalidArgumentException; |
| 7 | +useSymfony\Component\DependencyInjection\Exception\LogicException; |
| 8 | +useSymfony\Component\DependencyInjection\Exception\RuntimeException; |
| 9 | +useSymfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; |
| 10 | + |
| 11 | +/** |
| 12 | + * This class has been auto-generated |
| 13 | + * by the Symfony Dependency Injection Component. |
| 14 | + * |
| 15 | + * @final since Symfony 3.3 |
| 16 | + */ |
| 17 | +class Symfony_DI_PhpDumper_Test_CsvParametersextends Container |
| 18 | +{ |
| 19 | +private$parameters; |
| 20 | +private$targetDirs =array(); |
| 21 | + |
| 22 | +/** |
| 23 | + * @internal but protected for BC on cache:clear |
| 24 | + */ |
| 25 | +protected$privates =array(); |
| 26 | + |
| 27 | +publicfunction__construct() |
| 28 | + { |
| 29 | +$this->parameters =$this->getDefaultParameters(); |
| 30 | + |
| 31 | +$this->services =$this->privates =array(); |
| 32 | + |
| 33 | +$this->aliases =array(); |
| 34 | + } |
| 35 | + |
| 36 | +publicfunctionreset() |
| 37 | + { |
| 38 | +$this->privates =array(); |
| 39 | +parent::reset(); |
| 40 | + } |
| 41 | + |
| 42 | +publicfunctioncompile() |
| 43 | + { |
| 44 | +thrownewLogicException('You cannot compile a dumped container that was already compiled.'); |
| 45 | + } |
| 46 | + |
| 47 | +publicfunctionisCompiled() |
| 48 | + { |
| 49 | +returntrue; |
| 50 | + } |
| 51 | + |
| 52 | +publicfunctiongetRemovedIds() |
| 53 | + { |
| 54 | +returnarray( |
| 55 | +'Psr\\Container\\ContainerInterface' =>true, |
| 56 | +'Symfony\\Component\\DependencyInjection\\ContainerInterface' =>true, |
| 57 | + ); |
| 58 | + } |
| 59 | + |
| 60 | +publicfunctiongetParameter($name) |
| 61 | + { |
| 62 | +$name = (string)$name; |
| 63 | + |
| 64 | +if (!(isset($this->parameters[$name]) ||isset($this->loadedDynamicParameters[$name]) ||array_key_exists($name,$this->parameters))) { |
| 65 | +thrownewInvalidArgumentException(sprintf('The parameter "%s" must be defined.',$name)); |
| 66 | + } |
| 67 | +if (isset($this->loadedDynamicParameters[$name])) { |
| 68 | +return$this->loadedDynamicParameters[$name] ?$this->dynamicParameters[$name] :$this->getDynamicParameter($name); |
| 69 | + } |
| 70 | + |
| 71 | +return$this->parameters[$name]; |
| 72 | + } |
| 73 | + |
| 74 | +publicfunctionhasParameter($name) |
| 75 | + { |
| 76 | +$name = (string)$name; |
| 77 | + |
| 78 | +returnisset($this->parameters[$name]) ||isset($this->loadedDynamicParameters[$name]) ||array_key_exists($name,$this->parameters); |
| 79 | + } |
| 80 | + |
| 81 | +publicfunctionsetParameter($name,$value) |
| 82 | + { |
| 83 | +thrownewLogicException('Impossible to call set() on a frozen ParameterBag.'); |
| 84 | + } |
| 85 | + |
| 86 | +publicfunctiongetParameterBag() |
| 87 | + { |
| 88 | +if (null ===$this->parameterBag) { |
| 89 | +$parameters =$this->parameters; |
| 90 | +foreach ($this->loadedDynamicParametersas$name =>$loaded) { |
| 91 | +$parameters[$name] =$loaded ?$this->dynamicParameters[$name] :$this->getDynamicParameter($name); |
| 92 | + } |
| 93 | +$this->parameterBag =newFrozenParameterBag($parameters); |
| 94 | + } |
| 95 | + |
| 96 | +return$this->parameterBag; |
| 97 | + } |
| 98 | + |
| 99 | +private$loadedDynamicParameters =array( |
| 100 | +'hello' =>false, |
| 101 | + ); |
| 102 | +private$dynamicParameters =array(); |
| 103 | + |
| 104 | +/** |
| 105 | + * Computes a dynamic parameter. |
| 106 | + * |
| 107 | + * @param string The name of the dynamic parameter to load |
| 108 | + * |
| 109 | + * @return mixed The value of the dynamic parameter |
| 110 | + * |
| 111 | + * @throws InvalidArgumentException When the dynamic parameter does not exist |
| 112 | + */ |
| 113 | +privatefunctiongetDynamicParameter($name) |
| 114 | + { |
| 115 | +switch ($name) { |
| 116 | +case'hello':$value =$this->getEnv('csv:foo');break; |
| 117 | +default:thrownewInvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.',$name)); |
| 118 | + } |
| 119 | +$this->loadedDynamicParameters[$name] =true; |
| 120 | + |
| 121 | +return$this->dynamicParameters[$name] =$value; |
| 122 | + } |
| 123 | + |
| 124 | +/** |
| 125 | + * Gets the default parameters. |
| 126 | + * |
| 127 | + * @return array An array of the default parameters |
| 128 | + */ |
| 129 | +protectedfunctiongetDefaultParameters() |
| 130 | + { |
| 131 | +returnarray( |
| 132 | +'env(foo)' =>'foo,bar', |
| 133 | + ); |
| 134 | + } |
| 135 | +} |