Goetas\Twital\EventSubscriber\FixTwigExpressionSubscriber::removePlaceholder PHP Method

removePlaceholder() public method

public removePlaceholder ( SourceEvent $event )
$event Goetas\Twital\EventDispatcher\SourceEvent
    public function removePlaceholder(SourceEvent $event)
    {
        $source = $event->getTemplate();
        $placeholders = $this->placeholders;
        $source = $this->processPlaceholder($source, function ($matches) use($placeholders) {
            if (isset($placeholders[$matches[0]])) {
                return $placeholders[$matches[0]];
            } elseif (isset($placeholders[$matches[2]])) {
                return $matches[1] . $placeholders[$matches[2]];
            } else {
                return $matches[0];
            }
        });
        $event->setTemplate($source);
    }