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\MarkdownBundle\EventSubscriber;
use Symplify\PHP7_Sculpin\Bundle\MarkdownBundle\SculpinMarkdownBundle;
use Symplify\PHP7_Sculpin\Core\Event\SculpinEvents;
use Symplify\PHP7_Sculpin\Core\Event\SourceSetEvent;
use Symplify\PHP7_Sculpin\Core\Sculpin;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final class ConvertToMarkdownBeforeRunEventSubscriber implements EventSubscriberInterface
{
/**
* @var string[]
private $extensions = ['md', 'markdown'];
* {@inheritdoc}
public static function getSubscribedEvents() : array
return [
SculpinEvents::EVENT_BEFORE_RUN => 'beforeRun',
];
}
public function beforeRun(SourceSetEvent $sourceSetEvent)
foreach ($sourceSetEvent->updatedSources() as $source) {
foreach ($this->extensions as $extension) {
if (fnmatch("*.{$extension}", $source->filename())) {
$source->data()->append('converters', SculpinMarkdownBundle::CONVERTER_NAME);
break;