Raw   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 59
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getBindings() 0 3 1
A getValue() 0 3 1
A __toString() 0 3 1
A val() 0 3 1
1
<?php
2
3
namespace Pixie\QueryBuilder;
4
5
class Raw
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $value;
11
12
    /**
13
     * @var mixed[]
14
     */
15
    protected $bindings;
16
17
    /**
18
     * @param string $value
19
     * @param mixed|mixed[] $bindings
20
     */
21
    public function __construct($value, $bindings = [])
22
    {
23
        $this->value    = (string)$value;
24
        $this->bindings = (array)$bindings;
25
    }
26
27
    /**
28
     * Create a Raw instance with no bindings
29
     *
30
     * @param string $value
31
     * @return self
32
     */
33
    public static function val(string $value): self
34
    {
35
        return new self($value, []);
36
    }
37
38
    /**
39
     * Returns the current bindings
40
     *
41
     * @return mixed[]
42
     */
43
    public function getBindings(): array
44
    {
45
        return $this->bindings;
46
    }
47
48
    /**
49
     * Returns the current value held.
50
     *
51
     * @return string
52
     */
53
    public function getValue(): string
54
    {
55
        return (string) $this->value;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function __toString()
62
    {
63
        return (string)$this->value;
64
    }
65
}
66