Failed Conditions
Pull Request — develop (#6947)
by Filippo
10:01
created

AvgFunction::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
nc 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Query\AST\Functions;
6
7
use Doctrine\ORM\Query\Parser;
8
use Doctrine\ORM\Query\SqlWalker;
9
use Doctrine\ORM\Query\AST\AggregateExpression;
10
11
/**
12
 * "AVG" "(" ["DISTINCT"] StringPrimary ")"
13
 *
14
 * @since   2.6
15
 * @author  Mathew Davies <[email protected]>
16
 */
17
final class AvgFunction extends FunctionNode
18
{
19
    /**
20
     * @var AggregateExpression
21
     */
22
    private $aggregateExpression;
23
24
    /**
25
     * @inheritDoc
26
     */
27 3
    public function getSql(SqlWalker $sqlWalker): string
28
    {
29 3
        return $this->aggregateExpression->dispatch($sqlWalker);
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35 3
    public function parse(Parser $parser): void
36
    {
37 3
        $this->aggregateExpression = $parser->AggregateExpression();
38 3
    }
39
}
40