Test Failed
Push — regexp ( bbbe5d )
by Martin
12:32 queued 21s
created

Row   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A customizeFunction() 0 3 1
A getNodeMappingPattern() 0 3 1
A validateArguments() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;
6
7
use Doctrine\ORM\Query\AST\Node;
8
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException;
9
10
/**
11
 * Implementation of PostgreSQL Row Constructor expression.
12
 *
13
 * @see https://www.postgresql.org/docs/14/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
14
 */
15
class Row extends BaseVariadicFunction
16
{
17
    protected function getNodeMappingPattern(): array
18
    {
19
        return ['InParameter'];
20
    }
21
22
    protected function customizeFunction(): void
23
    {
24
        $this->setFunctionPrototype('ROW(%s)');
25
    }
26
27
    protected function validateArguments(Node ...$arguments): void
28
    {
29
        $argumentCount = \count($arguments);
30
        if ($argumentCount === 0) {
31
            throw InvalidArgumentForVariadicFunctionException::atLeast('ROW', 1);
32
        }
33
    }
34
}
35