tName()));
}
$this->staging->addFilter($filter);
}
public function getFilters() : array
{
if (!$this->initialized) {
$this->initExtensions();
}
return $this->filters;
}
public function getFilter(string $name) : ?TwigFilter
{
if (!$this->initialized) {
$this->initExtensions();
}
if (isset($this->filters[$name])) {
return $this->filters[$name];
}
foreach ($this->filters as $pattern => $filter) {
$pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count);
if ($count && \preg_match('#^' . $pattern . '$#', $name, $matches)) {
\array_shift($matches);
$filter->setArguments($matches);
return $filter;
}
}
foreach ($this->filterCallbacks as $callback) {
if (\false !== ($filter = $callback($name))) {
return $filter;
}
}
return null;
}
public function registerUndefinedFilterCallback(callable $callable) : void
{
$this->filterCallbacks[] = $callable;
}
public function addNodeVisitor(NodeVisitorInterface $visitor) : void
{
if ($this->initialized) {
throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.');
}
$this->staging->addNodeVisitor($visitor);
}
public function getNodeVisitors() : array
{
if (!$this->initialized) {
$this->initExtensions();
}
return $this->visitors;
}
public function addTokenParser(TokenParserInterface $parser) : void
{
if ($this->initialized) {
throw new \LogicException('Unable to add a token parser as extensions have already been initialized.');
}
$this->staging->addTokenParser($parser);
}
public function getTokenParsers() : array
{
if (!$this->initialized) {
$this->initExtensions();
}
return $this->parsers;
}
public function getTokenParser(string $name) : ?TokenParserInterface
{
if (!$this->initialized) {
$this->initExtensions();
}
if (isset($this->parsers[$name])) {
return $this->parsers[$name];
}
foreach ($this->parserCallbacks as $callback) {
if (\false !== ($parser = $callback($name))) {
return $parser;
}
}
return null;
}
public function registerUndefinedTokenParserCallback(callable $callable) : void
{
$this->parserCallbacks[] = $callable;
}
public function getGlobals() : array
{
if (null !== $this->globals) {
return $this->globals;
}
$globals = [];
foreach ($this->extensions as $extension) {
if (!$extension instanceof GlobalsInterface) {
continue;
}
$extGlobals = $extension->getGlobals();
if (!\is_array($extGlobals)) {
throw new \UnexpectedValueException(\sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension)));
}
$globals = \array_merge($globals, $extGlobals);
}
if ($this->initialized) {
$this->globals = $globals;
}
return $globals;
}
public function addTest(TwigTest $test) : void
{
if ($this->initialized) {
throw new \LogicException(\sprintf('Unable to add test "%s" as extensions have already been initialized.', $test->getName()));
}
$this->staging->addTest($test);
}
public function getTests() : array
{
if (!$this->initialized) {
$this->initExtensions();
}
return $this->tests;
}
public function getTest(string $name) : ?TwigTest
{
if (!$this->initialized) {
$this->initExtensions();
}
if (isset($this->tests[$name])) {
return $this->tests[$name];
}
foreach ($this->tests as $pattern => $test) {
$pattern = \str_replace('\\*', '(.*?)', \preg_quote($pattern, '#'), $count);
if ($count) {
if (\preg_match('#^' . $pattern . '$#', $name, $matches)) {
\array_shift($matches);
$test->setArguments($matches);
return $test;
}
}
}
return null;
}
public function getUnaryOperators() : array
{
if (!$this->initialized) {
$this->initExtensions();
}
return $this->unaryOperators;
}
public function getBinaryOperators() : array
{
if (!$this->initialized) {
$this->initExtensions();
}
return $this->binaryOperators;
}
private function initExtensions() : void
{
$this->parsers = [];
$this->filters = [];
$this->functions = [];
$this->tests = [];
$this->visitors = [];
$this->unaryOperators = [];
$this->binaryOperators = [];
foreach ($this->extensions as $extension) {
$this->initExtension($extension);
}
$this->initExtension($this->staging);
// Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception
$this->initialized = \true;
}
private function initExtension(ExtensionInterface $extension) : void
{
// filters
foreach ($extension->getFilters() as $filter) {
$this->filters[$filter->getName()] = $filter;
}
// functions
foreach ($extension->getFunctions() as $function) {
$this->functions[$function->getName()] = $function;
}
// tests
foreach ($extension->getTests() as $test) {
$this->tests[$test->getName()] = $test;
}
// token parsers
foreach ($extension->getTokenParsers() as $parser) {
if (!$parser instanceof TokenParserInterface) {
throw new \LogicException('getTokenParsers() must return an array of \\Twig\\TokenParser\\TokenParserInterface.');
}
$this->parsers[$parser->getTag()] = $parser;
}
// node visitors
foreach ($extension->getNodeVisitors() as $visitor) {
$this->visitors[] = $visitor;
}
// operators
if ($operators = $extension->getOperators()) {
if (!\is_array($operators)) {
throw new \InvalidArgumentException(\sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators) . (\is_resource($operators) ? '' : '#' . $operators)));
}
if (2 !== \count($operators)) {
throw new \InvalidArgumentException(\sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators)));
}
$this->unaryOperators = \array_merge($this->unaryOperators, $operators[0]);
$this->binaryOperators = \array_merge($this->binaryOperators, $operators[1]);
}
}
}
Fatal error: Uncaught Error: Class "MailPoetVendor\Twig\ExtensionSet" not found in /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/twig/twig/src/Environment.php:66
Stack trace:
#0 /htdocs/wp-content/plugins/mailpoet/lib/Config/Renderer.php(29): MailPoetVendor\Twig\Environment->__construct(Object(MailPoetVendor\Twig\Loader\FilesystemLoader), Array)
#1 /htdocs/wp-content/plugins/mailpoet/lib/Config/RendererFactory.php(19): MailPoet\Config\Renderer->__construct(false, '/htdocs/wp-cont...', Object(MailPoetVendor\Twig\Loader\FilesystemLoader), false)
#2 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2683): MailPoet\Config\RendererFactory->getRenderer()
#3 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2637): MailPoetGenerated\FreeCachedContainer->getRendererService()
#4 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService()
#5 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1)
#6 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...')
#7 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...')
#8 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(194): require_once('/htdocs/wp-cont...')
#9 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...')
#10 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...')
#11 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...')
#12 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...')
#13 /htdocs/index.php(17): require('/htdocs/wp-blog...')
#14 {main}
thrown in /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/twig/twig/src/Environment.php on line 66