Completed
Push — master ( b54f87...bde51f )
by Beniamin
04:50
created

SubQueryTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3
ccs 7
cts 7
cp 1
rs 10

2 Methods

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