2015-11-13 14:37:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\Operator\PHP;
|
2015-11-13 14:37:58 +01:00
|
|
|
|
2015-11-13 20:48:51 +01: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 18:26:14 +02:00
|
|
|
* It's registered in RulerZ using a service;
|
2015-11-13 20:48:51 +01:00
|
|
|
*/
|
2015-11-13 14:37:58 +01:00
|
|
|
class Matches
|
|
|
|
|
{
|
|
|
|
|
public function __invoke($subject, $pattern)
|
|
|
|
|
{
|
2017-10-09 16:47:15 +02:00
|
|
|
return false !== stripos($subject, $pattern);
|
2015-11-13 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
}
|