Total Complexity | 6 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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 |
||
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() |
||
81 | } |
||
82 | } |
||
83 |