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

BaseRegexpFunction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A customiseFunction() 0 7 2
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