for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace RunOpenCode\Twig\BufferizedTemplate;
use RunOpenCode\Twig\BufferizedTemplate\Tag\Bufferize\TokenParser;
class Extension extends \Twig_Extension
{
/**
* @var array
*/
private $settings;
public function __construct(array $settings = array())
$this->settings = array_merge(array(
'enabled' => true,
'nodes' => array(),
'whitelist' => array(),
'blacklist' => array(),
'bufferManager' => 'RunOpenCode\\Twig\\BufferizedTemplate\\Buffer\\BufferManager',
'defaultExecutionPriority' => 0,
'nodeVisitorPriority' => 10
), $settings);
$this->settings['nodes']['RunOpenCode\\Twig\\BufferizedTemplate\\Tag\\Bufferize\\Node'] = $this->settings['defaultExecutionPriority'];
if (count($this->settings['blacklist']) > 0 && count($this->settings['whitelist'])) {
throw new \InvalidArgumentException('You can use either black list or white list setting or non for bufferizing templates, but not both.');
}
* {@inheritdoc}
public function getNodeVisitors()
if ($this->settings['enabled']) {
return array(
new NodeVisitor($this->settings)
);
} else {
return array();
public function getTokenParsers()
new TokenParser()
public function createBuffer()
return new $this->settings['bufferManager']();