Completed
Push — master ( fd0133...375486 )
by Beniamin
02:35
created

SubQueryTable::getTableName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 2
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 $subQb;
16
17
    /**
18
     * @param BuilderInterface $subQb
19
     * @param BuilderInterface $qb
20
     */
21
    public function __construct(BuilderInterface $subQb, BuilderInterface $qb)
22
    {
23
        $this->subQb = $subQb;
24
        parent::__construct($qb);
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function getTableName()
31
    {
32
        $ref = $this->getQueryBuilder()->objectToString($this->subQb);
33
34
        return '(' . $ref . ')';
35
    }
36
}