Goetas\Twital\EventSubscriber\AbstractTwigExpressionSubscriber::__construct PHP Method

__construct() public method

public __construct ( array $placeholder = ['[_TWITAL_[', ']_TWITAL_]'], array $options = [] )
$placeholder array
$options array
    public function __construct(array $placeholder = array('[_TWITAL_[', ']_TWITAL_]'), array $options = array())
    {
        $this->placeholderFormat = $placeholder[0] . '%s' . $placeholder[1];
        $options = array_merge(array('tag_block' => array('{%', '%}'), 'tag_variable' => array('{{', '}}'), 'tag_comment' => array('{#', '#}')), $options);
        $this->regexes = array('twig_start' => '{(' . preg_quote($options['tag_block'][0]) . '|' . preg_quote($options['tag_variable'][0]) . '|' . preg_quote($options['tag_comment'][0]) . ')}', 'placeholder' => '{(' . preg_quote($placeholder[0]) . '(.+)' . preg_quote($placeholder[1]) . ')}siuU', 'twig_inner_' . $options['tag_block'][0] => '{(' . self::REGEX_STRING . '|' . preg_quote($options['tag_block'][1]) . '|([^"\']*?' . preg_quote($options['tag_block'][1]) . ')|[^"\']*)}si', 'twig_inner_' . $options['tag_variable'][0] => '{(' . self::REGEX_STRING . '|' . preg_quote($options['tag_variable'][1]) . '|([^"\']*?' . preg_quote($options['tag_variable'][1]) . ')|[^"\']*)}si', 'twig_inner_' . $options['tag_comment'][0] => '{((.*?' . preg_quote($options['tag_comment'][1]) . '))}si');
    }

Usage Example

 public function __construct($placeholder = array('twital', 'twital'), array $options = array())
 {
     parent::__construct($placeholder, $options);
     $this->regexes = array_merge($this->regexes, array('placeholder' => '{( ?)(' . preg_quote($placeholder[0]) . '[a-z0-9]+?' . preg_quote($placeholder[1]) . ')}iu'));
 }
All Usage Examples Of Goetas\Twital\EventSubscriber\AbstractTwigExpressionSubscriber::__construct
AbstractTwigExpressionSubscriber