mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-31 18:31:02 +00:00
Move source files directly under src/ directory
This commit is contained in:
parent
804261bc26
commit
a37b385c23
190 changed files with 19 additions and 21 deletions
25
src/Operator/Doctrine/Matches.php
Normal file
25
src/Operator/Doctrine/Matches.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Operator\Doctrine;
|
||||
|
||||
/**
|
||||
* 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 DQL, usable
|
||||
* by Doctrine ORM.
|
||||
* It's registered in RulerZ using a service;
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
25
src/Operator/Doctrine/NotMatches.php
Normal file
25
src/Operator/Doctrine/NotMatches.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\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)
|
||||
{
|
||||
if ("'" === $pattern[0]) {
|
||||
$pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
|
||||
}
|
||||
|
||||
return sprintf('UPPER(%s) NOT LIKE UPPER(%s)', $subject, $pattern);
|
||||
}
|
||||
}
|
21
src/Operator/PHP/Matches.php
Normal file
21
src/Operator/PHP/Matches.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Operator\PHP;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* It's registered in RulerZ using a service;
|
||||
*/
|
||||
class Matches
|
||||
{
|
||||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
return false !== stripos($subject, $pattern);
|
||||
}
|
||||
}
|
21
src/Operator/PHP/NotMatches.php
Normal file
21
src/Operator/PHP/NotMatches.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Operator\PHP;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* It's registered in RulerZ using a service;
|
||||
*/
|
||||
class NotMatches
|
||||
{
|
||||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
return false === stripos($subject, $pattern);
|
||||
}
|
||||
}
|
23
src/Operator/PHP/PatternMatches.php
Normal file
23
src/Operator/PHP/PatternMatches.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Operator\PHP;
|
||||
|
||||
/**
|
||||
* Provides a "~" operator used for ignore origin rules.
|
||||
*
|
||||
* It asserts that a subject matches a given regexp pattern, in a
|
||||
* case-insensitive way.
|
||||
*
|
||||
* This operator will be used to compile ignore origin rules in PHP, usable
|
||||
* directly on Entry objects for instance.
|
||||
* It's registered in RulerZ using a service;
|
||||
*/
|
||||
class PatternMatches
|
||||
{
|
||||
public function __invoke($subject, $pattern)
|
||||
{
|
||||
$count = preg_match("`$pattern`i", $subject);
|
||||
|
||||
return \is_int($count) && $count > 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue