forked from wallabag/wallabag
Add matches operator
This commit is contained in:
15
src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php
Normal file
15
src/Wallabag/CoreBundle/Operator/Doctrine/Matches.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Operator\Doctrine;
|
||||
|
||||
class Matches
|
||||
{
|
||||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
if ($pattern[0] === "'") {
|
||||
$pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
|
||||
}
|
||||
|
||||
return sprintf('UPPER(%s) LIKE UPPER(%s)', $subject, $pattern);
|
||||
}
|
||||
}
|
||||
11
src/Wallabag/CoreBundle/Operator/PHP/Matches.php
Normal file
11
src/Wallabag/CoreBundle/Operator/PHP/Matches.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Operator\PHP;
|
||||
|
||||
class Matches
|
||||
{
|
||||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
return stripos($subject, $pattern) !== false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user