function PhpDumper::export
8 calls to PhpDumper::export()
- PhpDumper::addDefaultParametersMethod in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::addDeprecatedAliases in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::addService in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::collectLineage in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - PhpDumper::dump in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - Dumps the service container as a PHP class.
File
-
vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php, line 2206
Class
- PhpDumper
- PhpDumper dumps a service container as a PHP class.
Namespace
Symfony\Component\DependencyInjection\DumperCode
private function export(mixed $value) : mixed {
if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, \PREG_OFFSET_CAPTURE)) {
$suffix = $matches[0][1] + \strlen($matches[0][0]);
$matches[0][1] += \strlen($matches[1][0]);
$prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true) . '.' : '';
if ('\\' === \DIRECTORY_SEPARATOR && isset($value[$suffix])) {
$cookie = '\\' . random_int(100000, \PHP_INT_MAX);
$suffix = '.' . $this->doExport(str_replace('\\', $cookie, substr($value, $suffix)), true);
$suffix = str_replace('\\' . $cookie, "'.\\DIRECTORY_SEPARATOR.'", $suffix);
}
else {
$suffix = isset($value[$suffix]) ? '.' . $this->doExport(substr($value, $suffix), true) : '';
}
$dirname = $this->asFiles ? '$container->containerDir' : '__DIR__';
$offset = 2 + $this->targetDirMaxMatches - \count($matches);
if (0 < $offset) {
$dirname = \sprintf('\\dirname(__DIR__, %d)', $offset + (int) $this->asFiles);
}
elseif ($this->asFiles) {
$dirname = "\$container->targetDir.''";
// empty string concatenation on purpose
}
if ($prefix || $suffix) {
return \sprintf('(%s%s%s)', $prefix, $dirname, $suffix);
}
return $dirname;
}
return $this->doExport($value, true);
}