aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Operator
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Operator')
-rw-r--r--src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php15
-rw-r--r--src/Wallabag/CoreBundle/Operator/PHP/Matches.php11
2 files changed, 26 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php b/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php
new file mode 100644
index 00000000..dc47c982
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php
@@ -0,0 +1,15 @@
1<?php
2
3namespace Wallabag\CoreBundle\Operator\Doctrine;
4
5class Matches
6{
7 public function __invoke($subject, $pattern)
8 {
9 if ($pattern[0] === "'") {
10 $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
11 }
12
13 return sprintf('UPPER(%s) LIKE UPPER(%s)', $subject, $pattern);
14 }
15}
diff --git a/src/Wallabag/CoreBundle/Operator/PHP/Matches.php b/src/Wallabag/CoreBundle/Operator/PHP/Matches.php
new file mode 100644
index 00000000..4768900c
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Operator/PHP/Matches.php
@@ -0,0 +1,11 @@
1<?php
2
3namespace Wallabag\CoreBundle\Operator\PHP;
4
5class Matches
6{
7 public function __invoke($subject, $pattern)
8 {
9 return stripos($subject, $pattern) !== false;
10 }
11}