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

Reference::sql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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