We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d4efae commit 8e96312Copy full SHA for 8e96312
src/TestPattern.php
@@ -4,13 +4,20 @@
4
5
namespace Kiboko\Component\StringExpressionLanguage;
6
7
-class TestPattern
+use Symfony\Component\ExpressionLanguage\ExpressionFunction;
8
+
9
+class TestPattern extends ExpressionFunction
10
{
11
public function __construct($name)
12
13
+ parent::__construct(
14
+ $name,
15
+ $this->compile(...)->bindTo($this),
16
+ $this->evaluate(...)->bindTo($this)
17
+ );
18
}
19
- private function compile(string $pattern, string $subject): bool
20
+ private function compile(string $pattern, string $subject): string
21
22
return <<<PHP
23
\$result = preg_match({$pattern}, {$subject});
0 commit comments