for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is a part of Sculpin.
*
* (c) Dragonfly Development Inc.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symplify\PHP7_Sculpin\Bundle\TwigBundle\EventSubscriber;
use Symplify\PHP7_Sculpin\Bundle\TwigBundle\Twig\FlexibleExtensionFilesystemLoader;
use Symplify\PHP7_Sculpin\Core\Event\SculpinEvents;
use Symplify\PHP7_Sculpin\Core\Event\SourceSetEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final class CleanCacheBeforeRunSubscriber implements EventSubscriberInterface
{
/**
* @var FlexibleExtensionFilesystemLoader
private $flexibleExtensionFilesystemLoader;
public function __construct(FlexibleExtensionFilesystemLoader $flexibleExtensionFilesystemLoader)
$this->flexibleExtensionFilesystemLoader = $flexibleExtensionFilesystemLoader;
}
* {@inheritdoc}
public static function getSubscribedEvents() : array
return [
SculpinEvents::EVENT_BEFORE_RUN => 'beforeRun',
];
public function beforeRun(SourceSetEvent $sourceSetEvent)
if ($sourceSetEvent->sourceSet()->newSources()) {
$this->flexibleExtensionFilesystemLoader->clean();