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\MarkdownBundle\EventSubscriber;
use Symplify\PHP7_Sculpin\MarkdownBundle\MarkdownConverter;
use Symplify\PHP7_Sculpin\Event\SculpinEvents;
use Symplify\PHP7_Sculpin\Event\SourceSetEvent;
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', MarkdownConverter::NAME);
break;