Passed
Push — main ( ef688d...18ec90 )
by Martin
14:11
created

RegexpLike::getParameterCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;
6
7
/**
8
 * Implementation of PostgreSQL REGEXP_LIKE().
9
 *
10
 * Returns true if a string matches a POSIX regular expression pattern, or false if it does not.
11
 *
12
 * @see https://www.postgresql.org/docs/17/functions-matching.html#FUNCTIONS-POSIX-REGEXP
13
 * @since 2.0
14
 *
15
 * @author Martin Georgiev <[email protected]>
16
 *
17
 * @example Using it in DQL: "SELECT REGEXP_LIKE(e.text, 'pattern', 'i') FROM Entity e"
18
 */
19
class RegexpLike extends BaseVariadicFunction
20
{
21 3
    protected function getNodeMappingPattern(): array
22
    {
23 3
        return [
24 3
            'StringPrimary',
25 3
        ];
26
    }
27
28 3
    protected function getFunctionName(): string
29
    {
30 3
        return 'regexp_like';
31
    }
32
33 3
    protected function getMinArgumentCount(): int
34
    {
35 3
        return 2;
36
    }
37
38 3
    protected function getMaxArgumentCount(): int
39
    {
40 3
        return 3;
41
    }
42
}
43