return $placeholder; // return first result
} } if (!
preg_match('/^(?:[-.\w\\\\]*+:)*+\w++$/',
$env)) { throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.',
$name));
} if ($this->
has($name) && null
!== ($defaultValue = parent::
get($name)) && !\
is_string($defaultValue)) { throw new RuntimeException(sprintf('The default value of an env() parameter must be a string or null, but "%s" given to "%s".',
get_debug_type($defaultValue),
$name));
} $uniqueName =
hash('xxh128',
$name.'_'.self::
$counter++
);
$placeholder =
sprintf('%s_%s_%s',
$this->
getEnvPlaceholderUniquePrefix(),
strtr($env, ':-.\\', '____'
),
$uniqueName);
$this->envPlaceholders
[$env][$placeholder] =
$placeholder;
return $placeholder;
} return parent::
get($name);
} /**
* Gets the common env placeholder prefix for env vars created by this bag.
*/