Passed
Push — master ( 1f9550...1daf3f )
by compolom
01:47
created

Select::join()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
1
<?php
2
3
namespace Compolomus\LSQLQueryBuilder\Parts;
4
5
use Compolomus\LSQLQueryBuilder\System\{
6
    Traits\GetParts,
7
    Traits\Join as TJoin,
8
    Traits\Limit as TLimit,
9
    Traits\Where as TWhere,
10
    Traits\Order as TOrder,
11
    Traits\Group as TGroup,
12
    Traits\Caller,
13
    Fields
14
};
15
16
/**
17
 * @method string table()
18
 */
19
class Select
20
{
21
    use TJoin, TLimit, TWhere, TOrder, TGroup, Caller, GetParts;
22
23
    protected $fields;
24
25
    public function __construct(array $fields = [], bool $count = false)
26
    {
27
        $this->fields = new Fields($fields, $count);
28
    }
29
30
    public function getFields(): string
31
    {
32
        return $this->fields->result();
33
    }
34
35
    public function get(): string
36
    {
37
        return 'SELECT ' . $this->getFields() . ' FROM '
38
            . $this->table()
39
            . (!is_null($this->join) ? $this->join->result() : '')
40
            . $this->getParts();
41
    }
42
}
43