Spaces:
Runtime error
Runtime error
Download symfony/serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php from Alcazard/vibe-coding-api: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/spaces/Alcazard/vibe-coding-api/resolve/main/symfony/serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php
- Command line
-
hf download hf://spaces/Alcazard/vibe-coding-api/symfony/serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php
-
curl -L -o CompiledClassMetadataCacheWarmer.php https://huggingface.co/spaces/Alcazard/vibe-coding-api/resolve/main/symfony/serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php
1.56 kB
| /* | |
| * This file is part of the Symfony package. | |
| * | |
| * (c) Fabien Potencier <fabien@symfony.com> | |
| * | |
| * For the full copyright and license information, please view the LICENSE | |
| * file that was distributed with this source code. | |
| */ | |
| namespace Symfony\Component\Serializer\CacheWarmer; | |
| use Symfony\Component\Filesystem\Filesystem; | |
| use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; | |
| use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryCompiler; | |
| use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; | |
| /** | |
| * @author Fabien Bourigault <bourigaultfabien@gmail.com> | |
| */ | |
| final class CompiledClassMetadataCacheWarmer implements CacheWarmerInterface | |
| { | |
| public function __construct( | |
| private readonly array $classesToCompile, | |
| private readonly ClassMetadataFactoryInterface $classMetadataFactory, | |
| private readonly ClassMetadataFactoryCompiler $classMetadataFactoryCompiler, | |
| private readonly Filesystem $filesystem, | |
| ) { | |
| } | |
| public function warmUp(string $cacheDir, ?string $buildDir = null): array | |
| { | |
| $metadatas = []; | |
| foreach ($this->classesToCompile as $classToCompile) { | |
| $metadatas[] = $this->classMetadataFactory->getMetadataFor($classToCompile); | |
| } | |
| $code = $this->classMetadataFactoryCompiler->compile($metadatas); | |
| $this->filesystem->dumpFile("{$cacheDir}/serializer.class.metadata.php", $code); | |
| return []; | |
| } | |
| public function isOptional(): bool | |
| { | |
| return true; | |
| } | |
| } | |