Completed
Push — master ( 465cad...ece51a )
by Beniamin
02:47
created

SubQueryTable::getWrappedQueryBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Phuria\SQLBuilder\Table;
4
5
use Phuria\SQLBuilder\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 1
    public function __construct(BuilderInterface $subQb, BuilderInterface $qb)
22
    {
23 1
        $this->wrappedQueryBuilder = $subQb;
24 1
        parent::__construct($qb);
25 1
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 1
    public function getTableName()
31
    {
32 1
        $ref = $this->getQueryBuilder()->objectToString($this->wrappedQueryBuilder);
33
34 1
        return '(' . $ref . ')';
35
    }
36
37
    /**
38
     * @return BuilderInterface
39
     */
40 1
    public function getWrappedQueryBuilder()
41
    {
42 1
        return $this->wrappedQueryBuilder;
43
    }
44
}