Passed
Push — pg18-new-features ( 667e5f )
by Martin
14:43
created

JsonStripNulls   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getMaxArgumentCount() 0 3 1
A getNodeMappingPattern() 0 4 1
A getMinArgumentCount() 0 3 1
A getFunctionName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;
6
7
/**
8
 * Implementation of PostgreSQL JSON_STRIP_NULLS().
9
 *
10
 * Supports optional second parameter (PostgreSQL 18+) to control null stripping from arrays.
11
 *
12
 * @see https://www.postgresql.org/docs/18/functions-json.html
13
 * @since 0.10
14
 *
15
 * @author Martin Georgiev <[email protected]>
16
 */
17
class JsonStripNulls extends BaseVariadicFunction
18
{
19 1
    protected function getFunctionName(): string
20
    {
21 1
        return 'json_strip_nulls';
22
    }
23
24 1
    protected function getNodeMappingPattern(): array
25
    {
26 1
        return [
27 1
            'StringPrimary',
28 1
        ];
29
    }
30
31 1
    protected function getMinArgumentCount(): int
32
    {
33 1
        return 1;
34
    }
35
36 1
    protected function getMaxArgumentCount(): int
37
    {
38 1
        return 2;
39
    }
40
}
41