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

AvgFunction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 3 1
A getSql() 0 3 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