Completed
Push — master ( 53b35c...4f4192 )
by Peter
06:07
created

Field   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 26
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A transform() 0 4 1
1
<?php
2
3
namespace Happyr\DoctrineSpecification\Operand;
4
5
use Doctrine\ORM\QueryBuilder;
6
use Happyr\DoctrineSpecification\Query\Selection\Selection;
7
8
class Field implements Operand, Selection
9
{
10
    /**
11
     * @var string
12
     */
13
    private $fieldName = '';
14
15
    /**
16
     * @param string $fieldName
17
     */
18
    public function __construct($fieldName)
19
    {
20
        $this->fieldName = $fieldName;
21
    }
22
23
    /**
24
     * @param QueryBuilder $qb
25
     * @param string       $dqlAlias
26
     *
27
     * @return string
28
     */
29
    public function transform(QueryBuilder $qb, $dqlAlias)
30
    {
31
        return sprintf('%s.%s', $dqlAlias, $this->fieldName);
32
    }
33
}
34