Test Setup Failed
Branch master (10fdc5)
by Beniamin
35:44
created

SubQueryTable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getTableName() 0 6 1
A getWrappedQueryBuilder() 0 4 1
1
<?php
2
3
namespace Phuria\UnderQuery\Table;
4
5
use Phuria\UnderQuery\QueryBuilder\BuilderInterface;
6
7
/**
8
 * @author Beniamin Jonatan Šimko <[email protected]>
9
 */
10
class SubQueryTable extends AbstractTable
11
{
12
    /**
13
     * @var BuilderInterface
14
     */
15
    private $wrappedQueryBuilder;
16
17
    /**
18
     * @param BuilderInterface $subQb
19
     * @param BuilderInterface $qb
20
     */
21
    public function __construct(BuilderInterface $subQb, BuilderInterface $qb)
22
    {
23
        $this->wrappedQueryBuilder = $subQb;
24
        parent::__construct($qb);
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function getTableName()
31
    {
32
        $ref = $this->getQueryBuilder()->objectToString($this->wrappedQueryBuilder);
33
34
        return '(' . $ref . ')';
35
    }
36
37
    /**
38
     * @return BuilderInterface
39
     */
40
    public function getWrappedQueryBuilder()
41
    {
42
        return $this->wrappedQueryBuilder;
43
    }
44
}