Passed
Push — abstractions-and-refactors ( afab63...ef08c1 )
by Martin
03:28
created

BaseRegexpFunction::customiseFunction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;
6
7
abstract class BaseRegexpFunction extends BaseFunction
8
{
9
    abstract protected function getFunctionName(): string;
10
11
    abstract protected function getParameterCount(): int;
12
13
    protected function customiseFunction(): void
14
    {
15
        $parameters = \str_repeat(', %s', $this->getParameterCount() - 1);
16
        $this->setFunctionPrototype($this->getFunctionName().'(%s'.$parameters.')');
17
18
        for ($i = 0; $i < $this->getParameterCount(); $i++) {
19
            $this->addNodeMapping('StringPrimary');
20
        }
21
    }
22
}
23