Passed
Push — validate-arguments-for-variadi... ( 03b437 )
by Martin
03:26
created

Row::customizeFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException;
8
9
/**
10
 * Implementation of PostgreSQL Row Constructor expression.
11
 *
12
 * @see https://www.postgresql.org/docs/14/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
13
 */
14
class Row extends BaseVariadicFunction
15
{
16
    protected string $commonNodeMapping = 'InParameter';
17
18
    protected function customizeFunction(): void
19
    {
20
        $this->setFunctionPrototype('ROW(%s)');
21
    }
22
23
    protected function validateArguments(array $arguments): void
24
    {
25
        $argumentCount = \count($arguments);
26
        if ($argumentCount === 0) {
27
            throw InvalidArgumentForVariadicFunctionException::atLeast('ROW', 1);
28
        }
29
    }
30
}
31