Passed
Push — new-postgis-functions ( b27060 )
by Martin
14:48
created

ST_Relate   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getNodeMappingPattern() 0 3 1
A getMinArgumentCount() 0 3 1
A getFunctionName() 0 3 1
A getMaxArgumentCount() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;
6
7
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction;
8
9
/**
10
 * Implementation of PostGIS ST_Relate() function.
11
 *
12
 * Tests if two geometries have a topological relationship matching an Intersection Matrix pattern,
13
 * or computes their Intersection Matrix.
14
 *
15
 * @see https://postgis.net/docs/ST_Relate.html
16
 * @since 3.5
17
 *
18
 * @author Martin Georgiev <[email protected]>
19
 *
20
 * @example Using it in DQL: "WHERE ST_Relate(g.geometry1, g.geometry2, 'T*T***T**') = TRUE"
21
 * Returns boolean when 3 arguments provided, string (intersection matrix) when 2 arguments provided.
22
 */
23
class ST_Relate extends BaseVariadicFunction
24
{
25 1
    protected function getNodeMappingPattern(): array
26
    {
27 1
        return ['StringPrimary'];
28
    }
29
30 1
    protected function getFunctionName(): string
31
    {
32 1
        return 'ST_Relate';
33
    }
34
35 1
    protected function getMinArgumentCount(): int
36
    {
37 1
        return 2;
38
    }
39
40 1
    protected function getMaxArgumentCount(): int
41
    {
42 1
        return 3;
43
    }
44
}
45