ST_ConcaveHull::getNodeMappingPattern()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;
6
7
use Doctrine\ORM\Query\AST\Node;
8
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseVariadicFunction;
9
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Traits\BooleanValidationTrait;
10
11
/**
12
 * Implementation of PostGIS ST_ConcaveHull() function.
13
 *
14
 * Computes a possibly concave geometry that contains all input geometry vertices.
15
 * The result approaches the convex hull as the target percent increases.
16
 *
17
 * @see https://postgis.net/docs/ST_ConcaveHull.html
18
 * @since 4.0
19
 *
20
 * @author Martin Georgiev <[email protected]>
21
 *
22
 * @example Using it in DQL: "SELECT ST_CONCAVEHULL(g.geometry, 0.9) FROM Entity g"
23
 * @example Using it in DQL: "SELECT ST_CONCAVEHULL(g.geometry, 0.9, 'true') FROM Entity g"
24
 * Returns a concave hull polygon.
25
 */
26
class ST_ConcaveHull extends BaseVariadicFunction
27
{
28
    use BooleanValidationTrait;
0 ignored issues
show
Bug introduced by
The trait MartinGeorgiev\Doctrine\...\BooleanValidationTrait requires the property $value which is not provided by MartinGeorgiev\Doctrine\...\PostGIS\ST_ConcaveHull.
Loading history...
29
30 2
    protected function getNodeMappingPattern(): array
31
    {
32 2
        return [
33 2
            'StringPrimary,ArithmeticPrimary,StringPrimary',
34 2
            'StringPrimary,ArithmeticPrimary',
35 2
        ];
36
    }
37
38 2
    protected function getFunctionName(): string
39
    {
40 2
        return 'ST_ConcaveHull';
41
    }
42
43 2
    protected function getMinArgumentCount(): int
44
    {
45 2
        return 2;
46
    }
47
48 2
    protected function getMaxArgumentCount(): int
49
    {
50 2
        return 3;
51
    }
52
53 2
    protected function validateArguments(Node ...$arguments): void
54
    {
55 2
        parent::validateArguments(...$arguments);
56
57 2
        if (\count($arguments) === 3) {
58 2
            $this->validateBoolean($arguments[2], $this->getFunctionName());
59
        }
60
    }
61
}
62