@@ -15,14 +15,14 @@ |
||
15 | 15 | /** |
16 | 16 | * @param string $expression |
17 | 17 | */ |
18 | - public function __construct (string $expression) { |
|
18 | + public function __construct(string $expression) { |
|
19 | 19 | $this->expression = $expression; |
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - public function __toString () { |
|
25 | + public function __toString() { |
|
26 | 26 | return $this->expression; |
27 | 27 | } |
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param null|bool|string|Select $arg |
27 | 27 | * @return Predicate |
28 | 28 | */ |
29 | - public function is ($arg): Predicate { |
|
29 | + public function is($arg): Predicate { |
|
30 | 30 | if ($arg === null or is_bool($arg)) { |
31 | 31 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
32 | 32 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string|array|Select $arg |
44 | 44 | * @return Predicate |
45 | 45 | */ |
46 | - public function isEqual ($arg) { |
|
46 | + public function isEqual($arg) { |
|
47 | 47 | return Predicate::compare($this, $this->db->quoteMixed($arg)); |
48 | 48 | } |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param string|Select $arg |
54 | 54 | * @return Predicate |
55 | 55 | */ |
56 | - public function isGreater ($arg) { |
|
56 | + public function isGreater($arg) { |
|
57 | 57 | return Predicate::compare($this, $this->db->quote($arg), '>', 'ALL'); |
58 | 58 | } |
59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param string|Select $arg |
64 | 64 | * @return Predicate |
65 | 65 | */ |
66 | - public function isGreaterOrEqual ($arg) { |
|
66 | + public function isGreaterOrEqual($arg) { |
|
67 | 67 | return Predicate::compare($this, $this->db->quote($arg), '>=', 'ALL'); |
68 | 68 | } |
69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string|Select $arg |
74 | 74 | * @return Predicate |
75 | 75 | */ |
76 | - public function isLess ($arg) { |
|
76 | + public function isLess($arg) { |
|
77 | 77 | return Predicate::compare($this, $this->db->quote($arg), '<', 'ALL'); |
78 | 78 | } |
79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string|Select $arg |
84 | 84 | * @return Predicate |
85 | 85 | */ |
86 | - public function isLessOrEqual ($arg) { |
|
86 | + public function isLessOrEqual($arg) { |
|
87 | 87 | return Predicate::compare($this, $this->db->quote($arg), '<=', 'ALL'); |
88 | 88 | } |
89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $pattern |
94 | 94 | * @return Predicate |
95 | 95 | */ |
96 | - public function isLike (string $pattern) { |
|
96 | + public function isLike(string $pattern) { |
|
97 | 97 | return Predicate::compare($this, $this->db->quote($pattern), 'LIKE'); |
98 | 98 | } |
99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param null|bool|string|Select $arg |
104 | 104 | * @return Predicate |
105 | 105 | */ |
106 | - public function isNot ($arg) { |
|
106 | + public function isNot($arg) { |
|
107 | 107 | return $this->is($arg)->invert(); |
108 | 108 | } |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param string|array|Select $arg |
114 | 114 | * @return Predicate |
115 | 115 | */ |
116 | - public function isNotEqual ($arg) { |
|
116 | + public function isNotEqual($arg) { |
|
117 | 117 | return Predicate::compare($this, $this->db->quoteMixed($arg), '<>', 'ALL', 'NOT IN'); |
118 | 118 | } |
119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param string $pattern |
124 | 124 | * @return Predicate |
125 | 125 | */ |
126 | - public function isNotLike (string $pattern) { |
|
126 | + public function isNotLike(string $pattern) { |
|
127 | 127 | return Predicate::compare($this, $this->db->quote($pattern), 'NOT LIKE'); |
128 | 128 | } |
129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string $pattern |
134 | 134 | * @return Predicate |
135 | 135 | */ |
136 | - public function isNotRegExp (string $pattern) { |
|
136 | + public function isNotRegExp(string $pattern) { |
|
137 | 137 | return Predicate::compare($this, $this->db->quote($pattern), 'NOT REGEXP'); |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $pattern |
144 | 144 | * @return Predicate |
145 | 145 | */ |
146 | - public function isRegExp (string $pattern) { |
|
146 | + public function isRegExp(string $pattern) { |
|
147 | 147 | return Predicate::compare($this, $this->db->quote($pattern), 'REGEXP'); |
148 | 148 | } |
149 | 149 | } |
150 | 150 | \ No newline at end of file |
@@ -29,8 +29,7 @@ |
||
29 | 29 | public function is ($arg): Predicate { |
30 | 30 | if ($arg === null or is_bool($arg)) { |
31 | 31 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
32 | - } |
|
33 | - else { |
|
32 | + } else { |
|
34 | 33 | $arg = $this->db->quote($arg); |
35 | 34 | } |
36 | 35 | $oper = ['mysql' => '<=>', 'sqlite' => 'IS'][$this->db->getDriver()]; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @return Text |
19 | 19 | */ |
20 | - public function getHex () { |
|
20 | + public function getHex() { |
|
21 | 21 | return new Text($this->db, "HEX({$this})"); |
22 | 22 | } |
23 | 23 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return Numeric |
30 | 30 | */ |
31 | - public function getLength () { |
|
31 | + public function getLength() { |
|
32 | 32 | switch ($this->db->getDriver()) { |
33 | 33 | case 'sqlite': |
34 | 34 | return new Numeric($this->db, "LENGTH(CAST({$this} AS TEXT))"); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return Text |
44 | 44 | */ |
45 | - public function getLower () { |
|
45 | + public function getLower() { |
|
46 | 46 | return new Text($this->db, "LOWER({$this})"); |
47 | 47 | } |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $substring |
55 | 55 | * @return Numeric |
56 | 56 | */ |
57 | - public function getPosition (string $substring) { |
|
57 | + public function getPosition(string $substring) { |
|
58 | 58 | $substring = $this->db->quote($substring); |
59 | 59 | switch ($this->db->getDriver()) { |
60 | 60 | case 'sqlite': |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param string $replace |
72 | 72 | * @return Text |
73 | 73 | */ |
74 | - public function getReplacement (string $search, string $replace) { |
|
74 | + public function getReplacement(string $search, string $replace) { |
|
75 | 75 | $search = $this->db->quote($search); |
76 | 76 | $replace = $this->db->quote($replace); |
77 | 77 | return new Text($this->db, "REPLACE({$this},{$search},{$replace})"); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return Numeric |
84 | 84 | */ |
85 | - public function getSize () { |
|
85 | + public function getSize() { |
|
86 | 86 | switch ($this->db->getDriver()) { |
87 | 87 | case 'sqlite': |
88 | 88 | return new Numeric($this->db, "LENGTH(CAST({$this} AS BLOB))"); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param int $length |
99 | 99 | * @return Text |
100 | 100 | */ |
101 | - public function getSubstring (int $start, int $length = null) { |
|
101 | + public function getSubstring(int $start, int $length = null) { |
|
102 | 102 | if (isset($length)) { |
103 | 103 | return new Text($this->db, "SUBSTR({$this},{$start},{$length})"); |
104 | 104 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return Text |
112 | 112 | */ |
113 | - public function getUpper () { |
|
113 | + public function getUpper() { |
|
114 | 114 | return new Text($this->db, "UPPER({$this})"); |
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
12 | 12 | use ComparisonTrait; |
13 | 13 | use AggregateTrait; |
14 | 14 | |
15 | - public function __construct (DB $db, string $expression) { |
|
15 | + public function __construct(DB $db, string $expression) { |
|
16 | 16 | $this->db = $db; |
17 | 17 | parent::__construct($expression); |
18 | 18 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param string $aggregate `ALL|DISTINCT` |
21 | 21 | * @return Numeric |
22 | 22 | */ |
23 | - public function getAvg ($aggregate = 'ALL') { |
|
23 | + public function getAvg($aggregate = 'ALL') { |
|
24 | 24 | return new Numeric($this->db, "AVG({$aggregate} {$this})"); |
25 | 25 | } |
26 | 26 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string $delimiter |
31 | 31 | * @return Text |
32 | 32 | */ |
33 | - public function getConcat (string $delimiter = ',') { |
|
33 | + public function getConcat(string $delimiter = ',') { |
|
34 | 34 | $delimiter = $this->db->quote($delimiter); |
35 | 35 | switch ($this->db->getDriver()) { |
36 | 36 | case 'sqlite': |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string $aggregate `ALL|DISTINCT` |
47 | 47 | * @return Numeric |
48 | 48 | */ |
49 | - public function getCount ($aggregate = 'ALL') { |
|
49 | + public function getCount($aggregate = 'ALL') { |
|
50 | 50 | return new Numeric($this->db, "COUNT({$aggregate} {$this})"); |
51 | 51 | } |
52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return Numeric |
57 | 57 | */ |
58 | - public function getMax () { |
|
58 | + public function getMax() { |
|
59 | 59 | return new Numeric($this->db, "MAX({$this})"); |
60 | 60 | } |
61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return Numeric |
66 | 66 | */ |
67 | - public function getMin () { |
|
67 | + public function getMin() { |
|
68 | 68 | return new Numeric($this->db, "MIN({$this})"); |
69 | 69 | } |
70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $aggregate `ALL|DISTINCT` |
75 | 75 | * @return Numeric |
76 | 76 | */ |
77 | - public function getSum ($aggregate = 'ALL') { |
|
77 | + public function getSum($aggregate = 'ALL') { |
|
78 | 78 | return new Numeric($this->db, "SUM({$aggregate} {$this})"); |
79 | 79 | } |
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -7,6 +7,6 @@ |
||
7 | 7 | */ |
8 | 8 | interface ExpressionInterface { |
9 | 9 | |
10 | - public function __toString (); |
|
10 | + public function __toString(); |
|
11 | 11 | |
12 | 12 | } |
13 | 13 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @param string[] $conditions |
18 | 18 | * @return Predicate |
19 | 19 | */ |
20 | - public static function all (array $conditions) { |
|
20 | + public static function all(array $conditions) { |
|
21 | 21 | if (count($conditions) === 1) { |
22 | 22 | return reset($conditions); |
23 | 23 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string[] $conditions |
31 | 31 | * @return Predicate |
32 | 32 | */ |
33 | - public static function any (array $conditions) { |
|
33 | + public static function any(array $conditions) { |
|
34 | 34 | if (count($conditions) === 1) { |
35 | 35 | return reset($conditions); |
36 | 36 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string $listOper |
58 | 58 | * @return Predicate |
59 | 59 | */ |
60 | - public static function compare ($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
60 | + public static function compare($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
61 | 61 | if (is_array($b)) { |
62 | 62 | return new static("{$a} {$listOper} (" . implode(',', $b) . ")"); |
63 | 63 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param string $listOper |
80 | 80 | * @return Predicate[] |
81 | 81 | */ |
82 | - public static function compareArray (array $values, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
82 | + public static function compareArray(array $values, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
|
83 | 83 | foreach ($values as $a => $b) { |
84 | 84 | $values[$a] = static::compare($a, $b, $oper, $subOper, $listOper); |
85 | 85 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return Predicate |
93 | 93 | */ |
94 | - public function invert () { |
|
94 | + public function invert() { |
|
95 | 95 | return new static("NOT({$this})"); |
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -60,8 +60,7 @@ |
||
60 | 60 | public static function compare ($a, $b, $oper = '=', $subOper = 'ANY', $listOper = 'IN') { |
61 | 61 | if (is_array($b)) { |
62 | 62 | return new static("{$a} {$listOper} (" . implode(',', $b) . ")"); |
63 | - } |
|
64 | - elseif ($b instanceof Select) { |
|
63 | + } elseif ($b instanceof Select) { |
|
65 | 64 | return new static("{$a} {$oper} {$subOper} ({$b->toSql()})"); |
66 | 65 | } |
67 | 66 | return new static("{$a} {$oper} {$b}"); |
@@ -173,8 +173,7 @@ discard block |
||
173 | 173 | public function group (string $column) { |
174 | 174 | if (!strlen($this->_group)) { |
175 | 175 | $this->_group = " GROUP BY {$column}"; |
176 | - } |
|
177 | - else { |
|
176 | + } else { |
|
178 | 177 | $this->_group .= ", {$column}"; |
179 | 178 | } |
180 | 179 | return $this; |
@@ -189,8 +188,7 @@ discard block |
||
189 | 188 | public function having (string $condition) { |
190 | 189 | if (!strlen($this->_having)) { |
191 | 190 | $this->_having = " HAVING {$condition}"; |
192 | - } |
|
193 | - else { |
|
191 | + } else { |
|
194 | 192 | $this->_having .= " AND {$condition}"; |
195 | 193 | } |
196 | 194 | return $this; |
@@ -222,8 +220,7 @@ discard block |
||
222 | 220 | public function limit (int $limit, int $offset = 0) { |
223 | 221 | if ($limit == 0) { |
224 | 222 | $this->_limit = ''; |
225 | - } |
|
226 | - else { |
|
223 | + } else { |
|
227 | 224 | $this->_limit = " LIMIT {$limit}"; |
228 | 225 | if ($offset > 1) { |
229 | 226 | $this->_limit .= " OFFSET {$offset}"; |
@@ -314,8 +311,7 @@ discard block |
||
314 | 311 | public function where (string $condition) { |
315 | 312 | if (!strlen($this->_where)) { |
316 | 313 | $this->_where = " WHERE {$condition}"; |
317 | - } |
|
318 | - else { |
|
314 | + } else { |
|
319 | 315 | $this->_where .= " AND {$condition}"; |
320 | 316 | } |
321 | 317 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string|Select $table |
74 | 74 | * @param string[] $columns |
75 | 75 | */ |
76 | - public function __construct (DB $db, $table, array $columns) { |
|
76 | + public function __construct(DB $db, $table, array $columns) { |
|
77 | 77 | parent::__construct($db); |
78 | 78 | if ($table instanceof Select) { |
79 | 79 | $table = $table->toSubquery(); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * Gives the clone a new alias. |
99 | 99 | */ |
100 | - public function __clone () { |
|
100 | + public function __clone() { |
|
101 | 101 | $this->alias = uniqid('_') . "__{$this->table}"; |
102 | 102 | } |
103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param array $args |
106 | 106 | * @return Statement |
107 | 107 | */ |
108 | - public function __invoke (array $args = []): Statement { |
|
108 | + public function __invoke(array $args = []): Statement { |
|
109 | 109 | return $this->execute($args); |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string |
116 | 116 | */ |
117 | - final public function __toString () { |
|
117 | + final public function __toString() { |
|
118 | 118 | return $this->alias; |
119 | 119 | } |
120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param array $args Execution arguments. |
125 | 125 | * @return int |
126 | 126 | */ |
127 | - public function count (array $args = []): int { |
|
127 | + public function count(array $args = []): int { |
|
128 | 128 | $clone = clone $this; |
129 | 129 | $clone->_columns = 'COUNT(*)'; |
130 | 130 | return (int)$clone->execute($args)->fetchColumn(); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param array $args |
137 | 137 | * @return Statement |
138 | 138 | */ |
139 | - public function execute (array $args = []): Statement { |
|
139 | + public function execute(array $args = []): Statement { |
|
140 | 140 | if (!empty($args)) { |
141 | 141 | return $this->prepare()->__invoke($args); |
142 | 142 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param array $args Execution arguments. |
152 | 152 | * @return array |
153 | 153 | */ |
154 | - public function fetchAll (array $args = []): array { |
|
154 | + public function fetchAll(array $args = []): array { |
|
155 | 155 | return iterator_to_array($this->fetcher->__invoke($this->execute($args))); |
156 | 156 | } |
157 | 157 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param array $args Execution arguments. |
165 | 165 | * @return Generator |
166 | 166 | */ |
167 | - public function fetchEach (array $args = []) { |
|
167 | + public function fetchEach(array $args = []) { |
|
168 | 168 | yield from $this->fetcher->__invoke($this->execute($args)); |
169 | 169 | } |
170 | 170 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return Generator |
177 | 177 | */ |
178 | - public function getIterator () { |
|
178 | + public function getIterator() { |
|
179 | 179 | yield from $this->fetchEach(); |
180 | 180 | } |
181 | 181 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param string $column |
186 | 186 | * @return $this |
187 | 187 | */ |
188 | - public function group (string $column) { |
|
188 | + public function group(string $column) { |
|
189 | 189 | if (!strlen($this->_group)) { |
190 | 190 | $this->_group = " GROUP BY {$column}"; |
191 | 191 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param string $condition |
202 | 202 | * @return $this |
203 | 203 | */ |
204 | - public function having (string $condition) { |
|
204 | + public function having(string $condition) { |
|
205 | 205 | if (!strlen($this->_having)) { |
206 | 206 | $this->_having = " HAVING {$condition}"; |
207 | 207 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param string $type |
220 | 220 | * @return $this |
221 | 221 | */ |
222 | - public function join ($table, string $condition, string $type = 'INNER') { |
|
222 | + public function join($table, string $condition, string $type = 'INNER') { |
|
223 | 223 | if ($table instanceof Select) { |
224 | 224 | $table = $table->toSubquery(); |
225 | 225 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @param int $offset |
235 | 235 | * @return $this |
236 | 236 | */ |
237 | - public function limit (int $limit, int $offset = 0) { |
|
237 | + public function limit(int $limit, int $offset = 0) { |
|
238 | 238 | if ($limit == 0) { |
239 | 239 | $this->_limit = ''; |
240 | 240 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $name Name or alias if used. |
254 | 254 | * @return bool |
255 | 255 | */ |
256 | - public function offsetExists ($name): bool { |
|
256 | + public function offsetExists($name): bool { |
|
257 | 257 | return true; |
258 | 258 | } |
259 | 259 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param string $name Name, or alias if used. |
264 | 264 | * @return Column |
265 | 265 | */ |
266 | - public function offsetGet ($name): Column { |
|
266 | + public function offsetGet($name): Column { |
|
267 | 267 | return new Column($this->db, $name, $this->alias); |
268 | 268 | } |
269 | 269 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param string $order |
274 | 274 | * @return $this |
275 | 275 | */ |
276 | - public function order (string $order) { |
|
276 | + public function order(string $order) { |
|
277 | 277 | if (strlen($order)) { |
278 | 278 | $order = " ORDER BY {$order}"; |
279 | 279 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | /** |
285 | 285 | * @return Statement |
286 | 286 | */ |
287 | - public function prepare (): Statement { |
|
287 | + public function prepare(): Statement { |
|
288 | 288 | return $this->db->prepare($this->toSql()); |
289 | 289 | } |
290 | 290 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param Closure $fetcher |
293 | 293 | * @return $this |
294 | 294 | */ |
295 | - public function setFetcher (Closure $fetcher) { |
|
295 | + public function setFetcher(Closure $fetcher) { |
|
296 | 296 | $this->fetcher = $fetcher; |
297 | 297 | return $this; |
298 | 298 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | /** |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - public function toSql (): string { |
|
303 | + public function toSql(): string { |
|
304 | 304 | $sql = "SELECT {$this->_columns} FROM {$this->table}"; |
305 | 305 | $sql .= $this->_join; |
306 | 306 | $sql .= $this->_where; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return string |
318 | 318 | */ |
319 | - public function toSubquery (): string { |
|
319 | + public function toSubquery(): string { |
|
320 | 320 | return "({$this->toSql()}) AS {$this->alias}"; |
321 | 321 | } |
322 | 322 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param string $condition |
327 | 327 | * @return $this |
328 | 328 | */ |
329 | - public function where (string $condition) { |
|
329 | + public function where(string $condition) { |
|
330 | 330 | if (!strlen($this->_where)) { |
331 | 331 | $this->_where = " WHERE {$condition}"; |
332 | 332 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param string $passwd |
54 | 54 | * @param array $options |
55 | 55 | */ |
56 | - public function __construct ($dsn, $username = null, $passwd = null, $options = null) { |
|
56 | + public function __construct($dsn, $username = null, $passwd = null, $options = null) { |
|
57 | 57 | parent::__construct($dsn, $username, $passwd, $options); |
58 | 58 | $this->driver = $this->getAttribute(self::ATTR_DRIVER_NAME); |
59 | 59 | $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $sql |
75 | 75 | * @return int |
76 | 76 | */ |
77 | - public function exec ($sql): int { |
|
77 | + public function exec($sql): int { |
|
78 | 78 | $this->logger->__invoke($sql); |
79 | 79 | return parent::exec($sql); |
80 | 80 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - final public function getDriver (): string { |
|
85 | + final public function getDriver(): string { |
|
86 | 86 | return $this->driver; |
87 | 87 | } |
88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param string $interface |
93 | 93 | * @return Junction |
94 | 94 | */ |
95 | - public function getJunction ($interface): Junction { |
|
95 | + public function getJunction($interface): Junction { |
|
96 | 96 | if (!isset($this->junctions[$interface])) { |
97 | 97 | $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @return Closure |
104 | 104 | */ |
105 | - public function getLogger (): Closure { |
|
105 | + public function getLogger(): Closure { |
|
106 | 106 | return $this->logger; |
107 | 107 | } |
108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param string|EntityInterface $class |
113 | 113 | * @return Record |
114 | 114 | */ |
115 | - public function getRecord ($class): Record { |
|
115 | + public function getRecord($class): Record { |
|
116 | 116 | $name = $class; |
117 | 117 | if (is_object($name)) { |
118 | 118 | $name = get_class($name); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param mixed $b |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function match ($a, $b) { |
|
140 | + public function match($a, $b) { |
|
141 | 141 | if ($b instanceof Closure) { |
142 | 142 | if (!$a instanceof Column) { |
143 | 143 | $a = new Column($this, $a); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param array $match |
164 | 164 | * @return string[] |
165 | 165 | */ |
166 | - public function matchArray (array $match) { |
|
166 | + public function matchArray(array $match) { |
|
167 | 167 | return array_map([$this, 'match'], array_keys($match), $match); |
168 | 168 | } |
169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param string $access Class or interface name. |
172 | 172 | * @return bool |
173 | 173 | */ |
174 | - public function offsetExists ($access): bool { |
|
174 | + public function offsetExists($access): bool { |
|
175 | 175 | return (bool)$this->offsetGet($access); |
176 | 176 | } |
177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param string $access Class or interface name. |
180 | 180 | * @return null|Record|Junction |
181 | 181 | */ |
182 | - public function offsetGet ($access) { |
|
182 | + public function offsetGet($access) { |
|
183 | 183 | if (class_exists($access)) { |
184 | 184 | return $this->getRecord($access); |
185 | 185 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param void $value |
197 | 197 | * @throws Exception |
198 | 198 | */ |
199 | - final public function offsetSet ($access, $value): void { |
|
199 | + final public function offsetSet($access, $value): void { |
|
200 | 200 | throw new Exception('The schema is immutable.'); |
201 | 201 | } |
202 | 202 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param void $access |
207 | 207 | * @throws Exception |
208 | 208 | */ |
209 | - final public function offsetUnset ($access): void { |
|
209 | + final public function offsetUnset($access): void { |
|
210 | 210 | $this->offsetSet($access, null); |
211 | 211 | } |
212 | 212 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param array $options |
218 | 218 | * @return Statement |
219 | 219 | */ |
220 | - public function prepare ($sql, $options = []): Statement { |
|
220 | + public function prepare($sql, $options = []): Statement { |
|
221 | 221 | $this->logger->__invoke($sql); |
222 | 222 | /** @var Statement $statement */ |
223 | 223 | $statement = parent::prepare($sql, $options); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param array $ctorargs |
234 | 234 | * @return Statement |
235 | 235 | */ |
236 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []): Statement { |
|
236 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []): Statement { |
|
237 | 237 | $this->logger->__invoke($sql); |
238 | 238 | /** @var Statement $statement */ |
239 | 239 | $statement = parent::query(...func_get_args()); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param int $type Ignored. |
253 | 253 | * @return string |
254 | 254 | */ |
255 | - public function quote ($value, $type = null) { |
|
255 | + public function quote($value, $type = null) { |
|
256 | 256 | if ($value instanceof ExpressionInterface) { |
257 | 257 | return $value; |
258 | 258 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param array $values |
273 | 273 | * @return array |
274 | 274 | */ |
275 | - public function quoteArray (array $values): array { |
|
275 | + public function quoteArray(array $values): array { |
|
276 | 276 | return array_map([$this, 'quote'], $values); |
277 | 277 | } |
278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param mixed $value |
283 | 283 | * @return array|string |
284 | 284 | */ |
285 | - public function quoteMixed ($value) { |
|
285 | + public function quoteMixed($value) { |
|
286 | 286 | if (is_array($value)) { |
287 | 287 | return $this->quoteArray($value); |
288 | 288 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @param EntityInterface $entity |
296 | 296 | * @return int ID |
297 | 297 | */ |
298 | - public function save (EntityInterface $entity): int { |
|
298 | + public function save(EntityInterface $entity): int { |
|
299 | 299 | return $this->getRecord($entity)->save($entity); |
300 | 300 | } |
301 | 301 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param Closure $logger |
304 | 304 | * @return $this |
305 | 305 | */ |
306 | - public function setLogger (Closure $logger) { |
|
306 | + public function setLogger(Closure $logger) { |
|
307 | 307 | $this->logger = $logger; |
308 | 308 | return $this; |
309 | 309 | } |