Failed Conditions
Pull Request — master (#106)
by
unknown
02:08
created

UUIDStringToNum   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 18
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A needsEncoding() 0 3 1
A __construct() 0 3 1
A getValue() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ClickHouseDB\Query\Expression;
6
7
use function sprintf;
8
9
/**
10
 * Pass expression "as is" to be sent and executed at server.
11
 * P.ex.: `new Expression\Function\UUIDStringToNum('0f372656-6a5b-4727-a4c4-f6357775d926');`
12
 */
13
class UUIDStringToNum implements Expression
14
{
15
    /** @var string */
16
    private $uuid;
17
18
    public function __construct(string $uuid)
19
    {
20
        $this->$uuid = $uuid;
21
    }
22
23
    public function needsEncoding() : bool
24
    {
25
        return false;
26
    }
27
28
    public function getValue() : string
29
    {
30
        return sprintf("UUIDStringToNum('%s')", $this->uuid);
31
    }
32
}
33