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

UUIDStringToNum   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

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
/**
8
 * Pass expression "as is" to be sent and executed at server.
9
 * P.ex.: `new Expression\Function\UUIDStringToNum('0f372656-6a5b-4727-a4c4-f6357775d926');`
10
 */
11
class UUIDStringToNum implements Expression
12
{
13
    /** @var string */
14
    private $uuid;
15
16
    public function __construct(string $uuid)
17
    {
18
        $this->$uuid = $uuid;
19
    }
20
21
    public function needsEncoding() : bool
22
    {
23
        return false;
24
    }
25
26
    public function getValue() : string
27
    {
28
        return "UUIDStringToNum('{$this->uuid}')";
0 ignored issues
show
Coding Style Best Practice introduced by
Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
29
    }
30
}
31