2015-11-13 13:37:58 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 00:30:12 +00:00
|
|
|
namespace Wallabag\Operator\PHP;
|
2015-11-13 13:37:58 +00:00
|
|
|
|
2015-11-13 19:48:51 +00:00
|
|
|
/**
|
|
|
|
* Provides a "matches" operator used for tagging rules.
|
|
|
|
*
|
|
|
|
* It asserts that a given pattern is 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;
|
2015-11-13 19:48:51 +00:00
|
|
|
*/
|
2015-11-13 13:37:58 +00:00
|
|
|
class Matches
|
|
|
|
{
|
|
|
|
public function __invoke($subject, $pattern)
|
|
|
|
{
|
2017-10-09 14:47:15 +00:00
|
|
|
return false !== stripos($subject, $pattern);
|
2015-11-13 13:37:58 +00:00
|
|
|
}
|
|
|
|
}
|