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

Query   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 74
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getQuery() 0 3 1
A getBinder() 0 3 1
A __toString() 0 3 1
A setQuery() 0 3 1
A setBinder() 0 5 1
A __construct() 0 4 1
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