This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Loader::resolveNestedVariables( string|null $value = null )
Resolve the nested variables.
Description
Look for ${varname} patterns in the variable value and replace with an existing environment variable.
Parameters
- $value
-
(string|null) (Optional)
Default value: null
Return
(string|null)
Source
File: vendor/vlucas/phpdotenv/src/Loader.php
private function resolveNestedVariables($value = null)
{
return Option::fromValue($value)
->filter(function ($str) {
return strpos($str, '$') !== false;
})
->flatMap(function ($str) {
return Regex::replaceCallback(
'/\${([a-zA-Z0-9_.]+)}/',
function (array $matches) {
return Option::fromValue($this->getEnvironmentVariable($matches[1]))
->getOrElse($matches[0]);
},
$str
)->success();
})
->getOrElse($value);
}