1 | <?php |
||
11 | class RegexpRule extends AbstractAtomicRule |
||
12 | { |
||
13 | /** @var string operator */ |
||
14 | const operator = 'regexp'; |
||
15 | |||
16 | /** @var mixed $value */ |
||
17 | protected $pattern; |
||
18 | |||
19 | /** |
||
20 | * |
||
21 | * @param string $field The field to apply the rule on. |
||
22 | * @param array $pattern The regular expression to match. |
||
23 | * |
||
24 | * @todo Support Posix? |
||
25 | */ |
||
26 | 13 | public function __construct( $field, $pattern ) |
|
31 | |||
32 | /** |
||
33 | */ |
||
34 | 13 | public function getPattern() |
|
38 | |||
39 | /** |
||
40 | * @return array |
||
41 | */ |
||
42 | 13 | public function getValues() |
|
46 | |||
47 | /** |
||
48 | * By default, every atomic rule can have a solution by itself |
||
49 | * |
||
50 | * @return bool |
||
51 | */ |
||
52 | 4 | public function hasSolution(array $simplification_options=[]) |
|
53 | { |
||
54 | 4 | return true; |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * Removes the delimiter and write the options in a MariaDB way. |
||
59 | * |
||
60 | * @param string The pattern written in a PHP PCRE way |
||
61 | * @return string The pattern in a MariaDB syntax |
||
62 | * |
||
63 | * @todo Find more difference between MariaDB and PHP and handle them. |
||
64 | * @see https://mariadb.com/kb/en/library/pcre/ |
||
65 | */ |
||
66 | 2 | public static function php2mariadbPCRE($php_regexp) |
|
83 | |||
84 | /**/ |
||
85 | } |
||
86 |