Passed
Push — master ( b817d9...04ae87 )
by 世昌
02:23
created

Query::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace suda\database\statement;
4
5
use suda\database\Binder;
6
7
class Query
8
{
9
10
    /**
11
     * SQL语句
12
     *
13
     * @var string
14
     */
15
    protected $query;
16
17
    /**
18
     * 绑定
19
     *
20
     * @var array
21
     */
22
    protected $binder;
23
24
    /**
25
     * Query constructor.
26
     * @param string $query
27
     * @param array $binder
28
     */
29
    public function __construct(string $query, array $binder = [])
30
    {
31
        $this->query = trim($query);
32
        $this->binder = $binder;
33
    }
34
35
    /**
36
     * Get 绑定
37
     *
38
     * @return  Binder[]
39
     */
40
    public function getBinder()
41
    {
42
        return $this->binder;
43
    }
44
45
    /**
46
     * Set 绑定
47
     *
48
     * @param Binder[] $binder 绑定
49
     *
50
     * @return  $this
51
     */
52
    public function setBinder(array $binder)
53
    {
54
        $this->binder = $binder;
55
56
        return $this;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getQuery(): string
63
    {
64
        return $this->query;
65
    }
66
67
    /**
68
     * @param string $query
69
     */
70
    public function setQuery(string $query): void
71
    {
72
        $this->query = $query;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function __toString()
79
    {
80
        return $this->query;
81
    }
82
}
83