2017-04-20 12:58:20 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 00:30:12 +00:00
|
|
|
namespace Wallabag\Operator\PHP;
|
2017-04-20 12:58:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 PHP, usable
|
|
|
|
* directly on Entry objects for instance.
|
2022-04-24 16:26:14 +00:00
|
|
|
* It's registered in RulerZ using a service;
|
2017-04-20 12:58:20 +00:00
|
|
|
*/
|
|
|
|
class NotMatches
|
|
|
|
{
|
|
|
|
public function __invoke($subject, $pattern)
|
|
|
|
{
|
2025-01-18 22:56:06 +00:00
|
|
|
if (null === $subject) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-10-09 14:47:15 +00:00
|
|
|
return false === stripos($subject, $pattern);
|
2017-04-20 12:58:20 +00:00
|
|
|
}
|
|
|
|
}
|