vendor/bundles/Symfony/Bundle/AsseticBundle/CacheWarmer/AssetWriterCacheWarmer.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the Symfony framework.
       
     5  *
       
     6  * (c) Fabien Potencier <fabien@symfony.com>
       
     7  *
       
     8  * This source file is subject to the MIT license that is bundled
       
     9  * with this source code in the file LICENSE.
       
    10  */
       
    11 
       
    12 namespace Symfony\Bundle\AsseticBundle\CacheWarmer;
       
    13 
       
    14 use Assetic\AssetWriter;
       
    15 use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
       
    16 use Symfony\Component\DependencyInjection\ContainerInterface;
       
    17 
       
    18 /**
       
    19  * The AssetWriterCacheWarmer processes and writes the asset files.
       
    20  *
       
    21  * @author Kris Wallsmith <kris@symfony.com>
       
    22  */
       
    23 class AssetWriterCacheWarmer implements CacheWarmerInterface
       
    24 {
       
    25     private $container;
       
    26     private $writer;
       
    27 
       
    28     public function __construct(ContainerInterface $container, AssetWriter $writer)
       
    29     {
       
    30         $this->container = $container;
       
    31         $this->writer = $writer;
       
    32     }
       
    33 
       
    34     public function warmUp($cacheDir)
       
    35     {
       
    36         $am = $this->container->get('assetic.asset_manager');
       
    37         $this->writer->writeManagerAssets($am);
       
    38     }
       
    39 
       
    40     public function isOptional()
       
    41     {
       
    42         return true;
       
    43     }
       
    44 }