function Preloader::append
1 call to Preloader::append()
- Kernel::initializeContainer in vendor/
symfony/ http-kernel/ Kernel.php - Initializes the service container.
File
-
vendor/
symfony/ dependency-injection/ Dumper/ Preloader.php, line 19
Class
- Preloader
- @author Nicolas Grekas <p@tchwork.com>
Namespace
Symfony\Component\DependencyInjection\DumperCode
public static function append(string $file, array $list) : void {
if (!file_exists($file)) {
throw new \LogicException(\sprintf('File "%s" does not exist.', $file));
}
$cacheDir = \dirname($file);
$classes = [];
foreach ($list as $item) {
if (str_starts_with($item, $cacheDir)) {
file_put_contents($file, \sprintf("require_once __DIR__.%s;\n", var_export(strtr(substr($item, \strlen($cacheDir)), \DIRECTORY_SEPARATOR, '/'), true)), \FILE_APPEND);
continue;
}
$classes[] = \sprintf("\$classes[] = %s;\n", var_export($item, true));
}
file_put_contents($file, \sprintf("\n\$classes = [];\n%s\$preloaded = Preloader::preload(\$classes, \$preloaded);\n", implode('', $classes)), \FILE_APPEND);
}