1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-05 19:31:02 +00:00
wallabag/src/Operator/Doctrine/NotMatches.php

26 lines
627 B
PHP
Raw Normal View History

<?php
2024-02-19 01:30:12 +01:00
namespace Wallabag\Operator\Doctrine;
/**
* Provides a "notmatches" operator used for tagging rules.
*
* It asserts that a given pattern is not contained in a subject, in a
* case-insensitive way.
*
* This operator will be used to compile tagging rules in DQL, usable
* by Doctrine ORM.
* It's registered in RulerZ using a service;
*/
class NotMatches
{
public function __invoke($subject, $pattern)
{
2017-10-09 16:47:15 +02:00
if ("'" === $pattern[0]) {
2024-08-14 16:39:36 +02:00
$pattern = \sprintf("'%%%s%%'", substr($pattern, 1, -1));
}
2024-08-14 16:39:36 +02:00
return \sprintf('UPPER(%s) NOT LIKE UPPER(%s)', $subject, $pattern);
}
}