Completed
Push — master ( e6533f...d6c42a )
by Woody
12s
created

Reference   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 4 1
A sql() 0 6 1
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Latitude\QueryBuilder;
5
6
class Reference implements Statement
7
{
8
    use Traits\CanUseDefaultIdentifier;
9
    use Traits\HasNoParameters;
10
11
    /**
12
     * Create a new table or column reference.
13
     */
14 12
    public static function make(string $reference)
15
    {
16 12
        return new static($reference);
17
    }
18
19
    // Statement
20 11
    public function sql(Identifier $identifier = null): string
21
    {
22 11
        $identifier = $this->getDefaultIdentifier($identifier);
23
24 11
        return $identifier->escapeQualified($this->reference);
25
    }
26
27
    /**
28
     * @var string
29
     */
30
    protected $reference;
31
32
    /**
33
     * @see Reference::make()
34
     */
35 12
    protected function __construct(string $reference)
36
    {
37 12
        $this->reference = $reference;
38 12
    }
39
}
40