mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-17 12:57:05 +00:00
fixed bad merge
This commit is contained in:
@@ -386,6 +386,19 @@ final class Twig_ExtensionSet
|
||||
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 false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class Twig_Test
|
||||
private $name;
|
||||
private $callable;
|
||||
private $options;
|
||||
private $arguments = array();
|
||||
|
||||
/**
|
||||
* Creates a template test.
|
||||
@@ -67,6 +68,16 @@ class Twig_Test
|
||||
return $this->options['node_class'];
|
||||
}
|
||||
|
||||
public function setArguments($arguments)
|
||||
{
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
public function getArguments()
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
|
||||
public function isVariadic()
|
||||
{
|
||||
return $this->options['is_variadic'];
|
||||
|
||||
Reference in New Issue
Block a user