@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return Text |
21 | 21 | */ |
22 | - public function date () { |
|
22 | + public function date() { |
|
23 | 23 | return Text::factory($this->db, $this->dateFormat('%Y-%m-%d')); |
24 | 24 | } |
25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|string[] $format Format, or formats keyed by driver name. |
30 | 30 | * @return Text |
31 | 31 | */ |
32 | - public function dateFormat ($format) { |
|
32 | + public function dateFormat($format) { |
|
33 | 33 | if (is_array($format)) { |
34 | 34 | $format = $format[$this->db->getDriver()]; |
35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return Text |
47 | 47 | */ |
48 | - public function datetime () { |
|
48 | + public function datetime() { |
|
49 | 49 | return Text::factory($this->db, $this->dateFormat([ |
50 | 50 | 'mysql' => '%Y-%m-%d %H:%i:%S', |
51 | 51 | 'sqlite' => '%Y-%m-%d %H:%M:%S' |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return Num |
59 | 59 | */ |
60 | - public function day () { |
|
60 | + public function day() { |
|
61 | 61 | return Num::factory($this->db, $this->dateFormat('%d')); |
62 | 62 | } |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return Num |
68 | 68 | */ |
69 | - public function dayOfWeek () { |
|
69 | + public function dayOfWeek() { |
|
70 | 70 | return Num::factory($this->db, $this->dateFormat('%w')); |
71 | 71 | } |
72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return Num |
77 | 77 | */ |
78 | - public function dayOfYear () { |
|
78 | + public function dayOfYear() { |
|
79 | 79 | return Num::factory($this->db, $this->dateFormat('%j')); |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return Num |
86 | 86 | */ |
87 | - public function hours () { |
|
87 | + public function hours() { |
|
88 | 88 | return Num::factory($this->db, $this->dateFormat('%H')); |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return Num |
95 | 95 | */ |
96 | - public function minutes () { |
|
96 | + public function minutes() { |
|
97 | 97 | return Num::factory($this->db, $this->dateFormat([ |
98 | 98 | 'mysql' => '%i', |
99 | 99 | 'sqlite' => '%M' |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return Num |
107 | 107 | */ |
108 | - public function month () { |
|
108 | + public function month() { |
|
109 | 109 | return Num::factory($this->db, $this->dateFormat('%m')); |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return Num |
116 | 116 | */ |
117 | - public function seconds () { |
|
117 | + public function seconds() { |
|
118 | 118 | return Num::factory($this->db, $this->dateFormat('%S')); |
119 | 119 | } |
120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return Text |
125 | 125 | */ |
126 | - public function time () { |
|
126 | + public function time() { |
|
127 | 127 | return Text::factory($this->db, $this->dateFormat([ |
128 | 128 | 'mysql' => '%H:%i:%S', |
129 | 129 | 'sqlite' => '%H:%M:%S' |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return Num |
137 | 137 | */ |
138 | - public function timestamp () { |
|
138 | + public function timestamp() { |
|
139 | 139 | if ($this->db->isSQLite()) { |
140 | 140 | return Num::factory($this->db, "STRFTIME('%s',{$this})"); |
141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @return Num |
149 | 149 | */ |
150 | - public function weekOfYear () { |
|
150 | + public function weekOfYear() { |
|
151 | 151 | return Num::factory($this->db, $this->dateFormat([ |
152 | 152 | 'mysql' => '%U', |
153 | 153 | 'sqlite' => '%W' |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @return Num |
161 | 161 | */ |
162 | - public function year () { |
|
162 | + public function year() { |
|
163 | 163 | return Num::factory($this->db, $this->dateFormat('%Y')); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @return Num |
16 | 16 | */ |
17 | - public function avg () { |
|
17 | + public function avg() { |
|
18 | 18 | return Num::factory($this->db, "AVG({$this})"); |
19 | 19 | } |
20 | 20 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return Num |
25 | 25 | */ |
26 | - public function avgDistinct () { |
|
26 | + public function avgDistinct() { |
|
27 | 27 | return Num::factory($this->db, "AVG(DISTINCT {$this})"); |
28 | 28 | } |
29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return Num |
34 | 34 | */ |
35 | - public function count () { |
|
35 | + public function count() { |
|
36 | 36 | return Num::factory($this->db, "COUNT({$this})"); |
37 | 37 | } |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return Num |
43 | 43 | */ |
44 | - public function countDistinct () { |
|
44 | + public function countDistinct() { |
|
45 | 45 | return Num::factory($this->db, "COUNT(DISTINCT {$this})"); |
46 | 46 | } |
47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param string $delimiter |
52 | 52 | * @return Text |
53 | 53 | */ |
54 | - public function groupConcat (string $delimiter = ',') { |
|
54 | + public function groupConcat(string $delimiter = ',') { |
|
55 | 55 | $delimiter = $this->db->quote($delimiter); |
56 | 56 | if ($this->db->isSQLite()) { |
57 | 57 | return Text::factory($this->db, "GROUP_CONCAT({$this},{$delimiter})"); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return Num |
66 | 66 | */ |
67 | - public function max () { |
|
67 | + public function max() { |
|
68 | 68 | return Num::factory($this->db, "MAX({$this})"); |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return Num |
75 | 75 | */ |
76 | - public function min () { |
|
76 | + public function min() { |
|
77 | 77 | return Num::factory($this->db, "MIN({$this})"); |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return Num |
84 | 84 | */ |
85 | - public function sum () { |
|
85 | + public function sum() { |
|
86 | 86 | return Num::factory($this->db, "SUM({$this})"); |
87 | 87 | } |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return Num |
93 | 93 | */ |
94 | - public function sumDistinct () { |
|
94 | + public function sumDistinct() { |
|
95 | 95 | return Num::factory($this->db, "SUM(DISTINCT {$this})"); |
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return Text |
18 | 18 | */ |
19 | - public function hex () { |
|
19 | + public function hex() { |
|
20 | 20 | return Text::factory($this->db, "HEX({$this})"); |
21 | 21 | } |
22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return Num |
29 | 29 | */ |
30 | - public function length () { |
|
30 | + public function length() { |
|
31 | 31 | if ($this->db->isSQLite()) { |
32 | 32 | return Num::factory($this->db, "LENGTH(CAST({$this} AS TEXT))"); |
33 | 33 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return Text |
43 | 43 | */ |
44 | - public function lower () { |
|
44 | + public function lower() { |
|
45 | 45 | return Text::factory($this->db, "LOWER({$this})"); |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param string $substring |
54 | 54 | * @return Num |
55 | 55 | */ |
56 | - public function position (string $substring) { |
|
56 | + public function position(string $substring) { |
|
57 | 57 | $substring = $this->db->quote($substring); |
58 | 58 | if ($this->db->isSQLite()) { |
59 | 59 | return Num::factory($this->db, "INSTR({$this},{$substring})"); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $replace |
71 | 71 | * @return Text |
72 | 72 | */ |
73 | - public function replace (string $search, string $replace) { |
|
73 | + public function replace(string $search, string $replace) { |
|
74 | 74 | $search = $this->db->quote($search); |
75 | 75 | $replace = $this->db->quote($replace); |
76 | 76 | return Text::factory($this->db, "REPLACE({$this},{$search},{$replace})"); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return Num |
83 | 83 | */ |
84 | - public function size () { |
|
84 | + public function size() { |
|
85 | 85 | if ($this->db->isSQLite()) { |
86 | 86 | return Num::factory($this->db, "LENGTH(CAST({$this} AS BLOB))"); |
87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param null|int $length |
98 | 98 | * @return Text |
99 | 99 | */ |
100 | - public function substr (int $start, int $length = null) { |
|
100 | + public function substr(int $start, int $length = null) { |
|
101 | 101 | if (isset($length)) { |
102 | 102 | return Text::factory($this->db, "SUBSTR({$this},{$start},{$length})"); |
103 | 103 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return Text |
113 | 113 | */ |
114 | - public function upper () { |
|
114 | + public function upper() { |
|
115 | 115 | return Text::factory($this->db, "UPPER({$this})"); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @return Num |
16 | 16 | */ |
17 | - public function abs () { |
|
17 | + public function abs() { |
|
18 | 18 | return Num::factory($this->db, "ABS({$this})"); |
19 | 19 | } |
20 | 20 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return Num |
25 | 25 | */ |
26 | - public function acos () { |
|
26 | + public function acos() { |
|
27 | 27 | return Num::factory($this->db, "ACOS({$this})"); |
28 | 28 | } |
29 | 29 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param number|ValueInterface $arg |
34 | 34 | * @return Num |
35 | 35 | */ |
36 | - public function add ($arg) { |
|
36 | + public function add($arg) { |
|
37 | 37 | $arg = $this->db->quote($arg); |
38 | 38 | return Num::factory($this->db, "({$this} + {$arg})"); |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return Num |
45 | 45 | */ |
46 | - public function asin () { |
|
46 | + public function asin() { |
|
47 | 47 | return Num::factory($this->db, "ASIN({$this})"); |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return Num |
54 | 54 | */ |
55 | - public function atan () { |
|
55 | + public function atan() { |
|
56 | 56 | return Num::factory($this->db, "ATAN({$this})"); |
57 | 57 | } |
58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return Num |
63 | 63 | */ |
64 | - public function ceil () { |
|
64 | + public function ceil() { |
|
65 | 65 | return Num::factory($this->db, "CEIL({$this})"); |
66 | 66 | } |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return Num |
72 | 72 | */ |
73 | - public function cos () { |
|
73 | + public function cos() { |
|
74 | 74 | return Num::factory($this->db, "COS({$this})"); |
75 | 75 | } |
76 | 76 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return Num |
83 | 83 | */ |
84 | - public function degrees () { |
|
84 | + public function degrees() { |
|
85 | 85 | return Num::factory($this->db, "DEGREES({$this})"); |
86 | 86 | } |
87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param number|ValueInterface $arg |
92 | 92 | * @return Num |
93 | 93 | */ |
94 | - public function div ($arg) { |
|
94 | + public function div($arg) { |
|
95 | 95 | $arg = $this->db->quote($arg); |
96 | 96 | return Num::factory($this->db, "({$this} / {$arg})"); |
97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return Num |
105 | 105 | */ |
106 | - public function exp () { |
|
106 | + public function exp() { |
|
107 | 107 | return Num::factory($this->db, "EXP({$this})"); |
108 | 108 | } |
109 | 109 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return Num |
114 | 114 | */ |
115 | - public function floor () { |
|
115 | + public function floor() { |
|
116 | 116 | return Num::factory($this->db, "FLOOR({$this})"); |
117 | 117 | } |
118 | 118 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return Predicate |
123 | 123 | */ |
124 | - public function isEven () { |
|
124 | + public function isEven() { |
|
125 | 125 | return Predicate::factory($this->db, "({$this} % 2) = 0"); |
126 | 126 | } |
127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return Predicate |
132 | 132 | */ |
133 | - public function isNegative () { |
|
133 | + public function isNegative() { |
|
134 | 134 | return Predicate::factory($this->db, "{$this} < 0"); |
135 | 135 | } |
136 | 136 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return Predicate |
141 | 141 | */ |
142 | - public function isOdd () { |
|
142 | + public function isOdd() { |
|
143 | 143 | return Predicate::factory($this->db, "({$this} % 2) <> 0"); |
144 | 144 | } |
145 | 145 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return Predicate |
150 | 150 | */ |
151 | - public function isPositive () { |
|
151 | + public function isPositive() { |
|
152 | 152 | return Predicate::factory($this->db, "{$this} > 0"); |
153 | 153 | } |
154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return Num |
159 | 159 | */ |
160 | - public function ln () { |
|
160 | + public function ln() { |
|
161 | 161 | return Num::factory($this->db, "LN({$this})"); |
162 | 162 | } |
163 | 163 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param float $base |
170 | 170 | * @return Num |
171 | 171 | */ |
172 | - public function log (float $base) { |
|
172 | + public function log(float $base) { |
|
173 | 173 | return Num::factory($this->db, "LOG({$base},{$this})"); |
174 | 174 | } |
175 | 175 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return Num |
180 | 180 | */ |
181 | - public function log10 () { |
|
181 | + public function log10() { |
|
182 | 182 | return Num::factory($this->db, "LOG10({$this})"); |
183 | 183 | } |
184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return Num |
189 | 189 | */ |
190 | - public function log2 () { |
|
190 | + public function log2() { |
|
191 | 191 | return Num::factory($this->db, "LOG2({$this})"); |
192 | 192 | } |
193 | 193 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param float $divisor |
198 | 198 | * @return Num |
199 | 199 | */ |
200 | - public function mod (float $divisor) { |
|
200 | + public function mod(float $divisor) { |
|
201 | 201 | return Num::factory($this->db, "({$this} % {$divisor})"); |
202 | 202 | } |
203 | 203 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param number|ValueInterface $arg |
208 | 208 | * @return Num |
209 | 209 | */ |
210 | - public function mul ($arg) { |
|
210 | + public function mul($arg) { |
|
211 | 211 | $arg = $this->db->quote($arg); |
212 | 212 | return Num::factory($this->db, "({$this} * {$arg})"); |
213 | 213 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param float $exponent |
219 | 219 | * @return Num |
220 | 220 | */ |
221 | - public function pow (float $exponent) { |
|
221 | + public function pow(float $exponent) { |
|
222 | 222 | return Num::factory($this->db, "POW({$this},{$exponent})"); |
223 | 223 | } |
224 | 224 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return Num |
231 | 231 | */ |
232 | - public function radians () { |
|
232 | + public function radians() { |
|
233 | 233 | return Num::factory($this->db, "RADIANS({$this})"); |
234 | 234 | } |
235 | 235 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param int $decimals |
240 | 240 | * @return Num |
241 | 241 | */ |
242 | - public function round (int $decimals = 0) { |
|
242 | + public function round(int $decimals = 0) { |
|
243 | 243 | return Num::factory($this->db, "ROUND({$this},{$decimals})"); |
244 | 244 | } |
245 | 245 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return Num `-1`, `0`, `1` |
250 | 250 | */ |
251 | - public function sign () { |
|
251 | + public function sign() { |
|
252 | 252 | return Num::factory($this->db, "SIGN({$this})"); |
253 | 253 | } |
254 | 254 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return Num |
259 | 259 | */ |
260 | - public function sin () { |
|
260 | + public function sin() { |
|
261 | 261 | return Num::factory($this->db, "SIN({$this})"); |
262 | 262 | } |
263 | 263 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @return Num |
268 | 268 | */ |
269 | - public function sqrt () { |
|
269 | + public function sqrt() { |
|
270 | 270 | return Num::factory($this->db, "SQRT({$this})"); |
271 | 271 | } |
272 | 272 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @param number|ValueInterface $arg |
277 | 277 | * @return Num |
278 | 278 | */ |
279 | - public function sub ($arg) { |
|
279 | + public function sub($arg) { |
|
280 | 280 | $arg = $this->db->quote($arg); |
281 | 281 | return Num::factory($this->db, "({$this} - {$arg})"); |
282 | 282 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return Num |
288 | 288 | */ |
289 | - public function tan () { |
|
289 | + public function tan() { |
|
290 | 290 | return Num::factory($this->db, "TAN({$this})"); |
291 | 291 | } |
292 | 292 | } |
293 | 293 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @param scalar[] $values |
13 | 13 | * @return Value |
14 | 14 | */ |
15 | - public function coalesce (array $values) { |
|
15 | + public function coalesce(array $values) { |
|
16 | 16 | array_unshift($values, $this); |
17 | 17 | $values = $this->db->quoteList($values); |
18 | 18 | return Value::factory($this->db, "COALESCE({$values})"); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param int $to |
26 | 26 | * @return Text |
27 | 27 | */ |
28 | - public function toBase (int $from, int $to) { |
|
28 | + public function toBase(int $from, int $to) { |
|
29 | 29 | return Text::factory($this->db, "CONV({$this},{$from},{$to})"); |
30 | 30 | } |
31 | 31 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param int $from |
36 | 36 | * @return Num |
37 | 37 | */ |
38 | - public function toBase10 (int $from) { |
|
38 | + public function toBase10(int $from) { |
|
39 | 39 | return Num::factory($this->db, "CONV({$this},{$from},10)"); |
40 | 40 | } |
41 | 41 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param int $from |
48 | 48 | * @return Text |
49 | 49 | */ |
50 | - public function toBase16 (int $from) { |
|
50 | + public function toBase16(int $from) { |
|
51 | 51 | return $this->toBase($from, 16); |
52 | 52 | } |
53 | 53 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param int $from |
58 | 58 | * @return Text |
59 | 59 | */ |
60 | - public function toBase2 (int $from) { |
|
60 | + public function toBase2(int $from) { |
|
61 | 61 | return $this->toBase($from, 2); |
62 | 62 | } |
63 | 63 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param int $from |
68 | 68 | * @return Text |
69 | 69 | */ |
70 | - public function toBase8 (int $from) { |
|
70 | + public function toBase8(int $from) { |
|
71 | 71 | return $this->toBase($from, 8); |
72 | 72 | } |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return Num |
78 | 78 | */ |
79 | - public function toFloat () { |
|
79 | + public function toFloat() { |
|
80 | 80 | if ($this->db->isSQLite()) { |
81 | 81 | return Num::factory($this->db, "CAST({$this} AS REAL)"); |
82 | 82 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return Num |
90 | 90 | */ |
91 | - public function toInt () { |
|
91 | + public function toInt() { |
|
92 | 92 | if ($this->db->isSQLite()) { |
93 | 93 | return Num::factory($this->db, "CAST({$this} AS INTEGER)"); |
94 | 94 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return Text |
102 | 102 | */ |
103 | - public function toText () { |
|
103 | + public function toText() { |
|
104 | 104 | if ($this->db->isSQLite()) { |
105 | 105 | return Text::factory($this->db, "CAST({$this} AS TEXT)"); |
106 | 106 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param DB $db |
35 | 35 | */ |
36 | - public function __construct (DB $db) { |
|
36 | + public function __construct(DB $db) { |
|
37 | 37 | $this->db = $db; |
38 | 38 | $db->beginTransaction(); |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Rolls back if the instance wasn't committed. |
43 | 43 | */ |
44 | - public function __destruct () { |
|
44 | + public function __destruct() { |
|
45 | 45 | if (!$this->committed) { |
46 | 46 | $this->db->rollBack(); |
47 | 47 | } |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return true |
56 | 56 | */ |
57 | - public function commit (): bool { |
|
57 | + public function commit(): bool { |
|
58 | 58 | return $this->committed or $this->committed = $this->db->commit(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @return bool |
63 | 63 | */ |
64 | - final public function wasCommitted (): bool { |
|
64 | + final public function wasCommitted(): bool { |
|
65 | 65 | return $this->committed; |
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $name |
43 | 43 | * @param string[] $columns |
44 | 44 | */ |
45 | - public function __construct (DB $db, string $name, array $columns) { |
|
45 | + public function __construct(DB $db, string $name, array $columns) { |
|
46 | 46 | parent::__construct($db); |
47 | 47 | $this->name = $name; |
48 | 48 | foreach ($columns as $column) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - final public function __toString () { |
|
58 | + final public function __toString() { |
|
59 | 59 | return $this->name; |
60 | 60 | } |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param array $values |
66 | 66 | * @return int Rows affected. |
67 | 67 | */ |
68 | - public function apply (array $values): int { |
|
68 | + public function apply(array $values): int { |
|
69 | 69 | $columns = implode(',', array_keys($values)); |
70 | 70 | $values = $this->db->quoteList($values); |
71 | 71 | if ($this->db->isSQLite()) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param Closure $prepare `():Statement` |
86 | 86 | * @return Statement |
87 | 87 | */ |
88 | - protected function cache (string $key, Closure $prepare) { |
|
88 | + protected function cache(string $key, Closure $prepare) { |
|
89 | 89 | return $this->_cache[$key] ??= $prepare->__invoke(); |
90 | 90 | } |
91 | 91 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param array $match `[a => b]` |
94 | 94 | * @return int |
95 | 95 | */ |
96 | - public function count (array $match = []) { |
|
96 | + public function count(array $match = []) { |
|
97 | 97 | $select = $this->select(['COUNT(*)']); |
98 | 98 | foreach ($match as $a => $b) { |
99 | 99 | $select->where($this->db->match($this[$a] ?? $a, $b)); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param array $match |
110 | 110 | * @return int Rows affected. |
111 | 111 | */ |
112 | - public function delete (array $match): int { |
|
112 | + public function delete(array $match): int { |
|
113 | 113 | foreach ($match as $a => $b) { |
114 | 114 | $match[$a] = $this->db->match($this[$a] ?? $a, $b); |
115 | 115 | } |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return Column[] |
122 | 122 | */ |
123 | - public function getColumns () { |
|
123 | + public function getColumns() { |
|
124 | 124 | return $this->columns; |
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
128 | 128 | * @return string |
129 | 129 | */ |
130 | - final public function getName (): string { |
|
130 | + final public function getName(): string { |
|
131 | 131 | return $this->name; |
132 | 132 | } |
133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param array $values |
138 | 138 | * @return Statement |
139 | 139 | */ |
140 | - public function insert (array $values) { |
|
140 | + public function insert(array $values) { |
|
141 | 141 | $columns = implode(',', array_keys($values)); |
142 | 142 | $values = $this->db->quoteList($values); |
143 | 143 | return $this->db->query("INSERT INTO {$this} ($columns) VALUES ($values)"); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param int|string $column |
148 | 148 | * @return Column |
149 | 149 | */ |
150 | - public function offsetGet ($column) { |
|
150 | + public function offsetGet($column) { |
|
151 | 151 | if (is_int($column)) { |
152 | 152 | return current(array_slice($this->columns, $column, 1)) ?: null; |
153 | 153 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string[] $columns |
161 | 161 | * @return Select|array[] |
162 | 162 | */ |
163 | - public function select (array $columns = ['*']) { |
|
163 | + public function select(array $columns = ['*']) { |
|
164 | 164 | return Select::factory($this->db, $this, $columns); |
165 | 165 | } |
166 | 166 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string $name |
171 | 171 | * @return Table |
172 | 172 | */ |
173 | - public function setName (string $name) { |
|
173 | + public function setName(string $name) { |
|
174 | 174 | $clone = clone $this; |
175 | 175 | $clone->name = $name; |
176 | 176 | foreach ($this->columns as $name => $column) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param array $match |
189 | 189 | * @return int Rows affected. |
190 | 190 | */ |
191 | - public function update (array $values, array $match): int { |
|
191 | + public function update(array $values, array $match): int { |
|
192 | 192 | foreach ($this->db->quoteArray($values) as $key => $value) { |
193 | 193 | $values[$key] = "{$key} = {$value}"; |
194 | 194 | } |
@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - abstract public function __toString (); |
|
19 | + abstract public function __toString(); |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Columns keyed by name/alias. |
23 | 23 | * |
24 | 24 | * @return Column[] |
25 | 25 | */ |
26 | - abstract public function getColumns (); |
|
26 | + abstract public function getColumns(); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @param int|string $column |
30 | 30 | * @return null|Column |
31 | 31 | */ |
32 | - abstract public function offsetGet ($column); |
|
32 | + abstract public function offsetGet($column); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @var DB |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @param DB $db |
41 | 41 | */ |
42 | - public function __construct (DB $db) { |
|
42 | + public function __construct(DB $db) { |
|
43 | 43 | $this->db = $db; |
44 | 44 | } |
45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param int|string $column |
48 | 48 | * @return bool |
49 | 49 | */ |
50 | - public function offsetExists ($column): bool { |
|
50 | + public function offsetExists($column): bool { |
|
51 | 51 | return $this->offsetGet($column) !== null; |
52 | 52 | } |
53 | 53 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param void $value |
59 | 59 | * @throws Exception |
60 | 60 | */ |
61 | - final public function offsetSet ($offset, $value): void { |
|
61 | + final public function offsetSet($offset, $value): void { |
|
62 | 62 | throw new Exception('Tables are immutable.'); |
63 | 63 | } |
64 | 64 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param void $name |
69 | 69 | * @throws Exception |
70 | 70 | */ |
71 | - final public function offsetUnset ($name): void { |
|
71 | + final public function offsetUnset($name): void { |
|
72 | 72 | $this->offsetSet($name, null); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $file |
84 | 84 | * @return static |
85 | 85 | */ |
86 | - public static function fromConfig (string $connection = 'default', string $file = 'db.config.php') { |
|
86 | + public static function fromConfig(string $connection = 'default', string $file = 'db.config.php') { |
|
87 | 87 | $config = (include "{$file}")[$connection]; |
88 | 88 | $args = [ |
89 | 89 | $config['dsn'], |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param int|array|Countable $count |
104 | 104 | * @return ExpressionInterface[] |
105 | 105 | */ |
106 | - public static function marks ($count): array { |
|
106 | + public static function marks($count): array { |
|
107 | 107 | static $mark; |
108 | 108 | $mark ??= new class implements ExpressionInterface { |
109 | 109 | |
110 | - public function __toString () { |
|
110 | + public function __toString() { |
|
111 | 111 | return '?'; |
112 | 112 | } |
113 | 113 | }; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param string[] $columns |
126 | 126 | * @return string[] `["column" => ":column"]` |
127 | 127 | */ |
128 | - public static function slots (array $columns): array { |
|
128 | + public static function slots(array $columns): array { |
|
129 | 129 | return array_combine($columns, array_map(function(string $column) { |
130 | 130 | return ':' . str_replace('.', '__', $column); |
131 | 131 | }, $columns)); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param string[] $columns |
136 | 136 | * @return string[] `["column" => "column=:column"]` |
137 | 137 | */ |
138 | - public static function slotsEqual (array $columns): array { |
|
138 | + public static function slotsEqual(array $columns): array { |
|
139 | 139 | $slots = static::slots($columns); |
140 | 140 | foreach ($slots as $column => $slot) { |
141 | 141 | $slots[$column] = "{$column} = {$slot}"; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param string $password |
154 | 154 | * @param array $options |
155 | 155 | */ |
156 | - public function __construct ($dsn, $username = null, $password = null, array $options = []) { |
|
156 | + public function __construct($dsn, $username = null, $password = null, array $options = []) { |
|
157 | 157 | $options[self::ATTR_STATEMENT_CLASS] ??= [Statement::class, [$this]]; |
158 | 158 | parent::__construct($dsn, $username, $password, $options); |
159 | 159 | $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | if ($this->isSQLite()) { |
168 | 168 | // polyfill sqlite functions |
169 | - $this->sqliteCreateFunctions([ // deterministic functions |
|
169 | + $this->sqliteCreateFunctions([// deterministic functions |
|
170 | 170 | // https://www.sqlite.org/lang_mathfunc.html |
171 | 171 | 'ACOS' => 'acos', |
172 | 172 | 'ASIN' => 'asin', |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | 'SIGN' => fn($x) => ($x > 0) - ($x < 0), |
193 | 193 | ]); |
194 | 194 | |
195 | - $this->sqliteCreateFunctions([ // non-deterministic |
|
195 | + $this->sqliteCreateFunctions([// non-deterministic |
|
196 | 196 | 'RAND' => fn() => mt_rand() / mt_getrandmax(), |
197 | 197 | ], false); |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return string |
205 | 205 | */ |
206 | - final public function __toString () { |
|
206 | + final public function __toString() { |
|
207 | 207 | return $this->driver; |
208 | 208 | } |
209 | 209 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return true |
216 | 216 | */ |
217 | - public function beginTransaction () { |
|
217 | + public function beginTransaction() { |
|
218 | 218 | assert($this->transactions >= 0); |
219 | 219 | if ($this->transactions === 0) { |
220 | 220 | $this->logger->__invoke("BEGIN TRANSACTION"); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @return true |
236 | 236 | */ |
237 | - public function commit () { |
|
237 | + public function commit() { |
|
238 | 238 | assert($this->transactions > 0); |
239 | 239 | if ($this->transactions === 1) { |
240 | 240 | $this->logger->__invoke("COMMIT TRANSACTION"); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param string $sql |
255 | 255 | * @return int |
256 | 256 | */ |
257 | - public function exec ($sql): int { |
|
257 | + public function exec($sql): int { |
|
258 | 258 | $this->logger->__invoke($sql); |
259 | 259 | return parent::exec($sql); |
260 | 260 | } |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | * @param mixed ...$args |
271 | 271 | * @return mixed |
272 | 272 | */ |
273 | - public function factory (string $class, ...$args) { |
|
273 | + public function factory(string $class, ...$args) { |
|
274 | 274 | return new $class($this, ...$args); |
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - final public function getDriver (): string { |
|
280 | + final public function getDriver(): string { |
|
281 | 281 | return $this->driver; |
282 | 282 | } |
283 | 283 | |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | * @param string $interface |
288 | 288 | * @return Junction |
289 | 289 | */ |
290 | - public function getJunction ($interface) { |
|
290 | + public function getJunction($interface) { |
|
291 | 291 | return $this->junctions[$interface] ??= Junction::fromInterface($this, $interface); |
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * @return Closure |
296 | 296 | */ |
297 | - public function getLogger () { |
|
297 | + public function getLogger() { |
|
298 | 298 | return $this->logger; |
299 | 299 | } |
300 | 300 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @param string $dir |
303 | 303 | * @return Migrator |
304 | 304 | */ |
305 | - public function getMigrator () { |
|
305 | + public function getMigrator() { |
|
306 | 306 | return Migrator::factory($this, $this->migrations); |
307 | 307 | } |
308 | 308 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @param string|EntityInterface $class |
313 | 313 | * @return Record |
314 | 314 | */ |
315 | - public function getRecord ($class) { |
|
315 | + public function getRecord($class) { |
|
316 | 316 | if (is_object($class)) { |
317 | 317 | $class = get_class($class); |
318 | 318 | } |
@@ -322,28 +322,28 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @return Schema |
324 | 324 | */ |
325 | - public function getSchema () { |
|
325 | + public function getSchema() { |
|
326 | 326 | return $this->schema; |
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
330 | 330 | * @return bool |
331 | 331 | */ |
332 | - final public function isMySQL (): bool { |
|
332 | + final public function isMySQL(): bool { |
|
333 | 333 | return $this->driver === 'mysql'; |
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
337 | 337 | * @return bool |
338 | 338 | */ |
339 | - final public function isPostgreSQL (): bool { |
|
339 | + final public function isPostgreSQL(): bool { |
|
340 | 340 | return $this->driver === 'pgsql'; |
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
344 | 344 | * @return bool |
345 | 345 | */ |
346 | - final public function isSQLite (): bool { |
|
346 | + final public function isSQLite(): bool { |
|
347 | 347 | return $this->driver === 'sqlite'; |
348 | 348 | } |
349 | 349 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @param mixed $b |
367 | 367 | * @return Predicate |
368 | 368 | */ |
369 | - public function match ($a, $b) { |
|
369 | + public function match($a, $b) { |
|
370 | 370 | if ($b instanceof Closure) { |
371 | 371 | return $b->__invoke($a, $this); |
372 | 372 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @return Transaction |
389 | 389 | */ |
390 | - public function newTransaction () { |
|
390 | + public function newTransaction() { |
|
391 | 391 | return Transaction::factory($this); |
392 | 392 | } |
393 | 393 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @param string $table |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - final public function offsetExists ($table): bool { |
|
400 | + final public function offsetExists($table): bool { |
|
401 | 401 | return (bool)$this->offsetGet($table); |
402 | 402 | } |
403 | 403 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param string $table |
408 | 408 | * @return null|Table |
409 | 409 | */ |
410 | - public function offsetGet ($table) { |
|
410 | + public function offsetGet($table) { |
|
411 | 411 | return $this->schema->getTable($table); |
412 | 412 | } |
413 | 413 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @param $value |
417 | 417 | * @throws LogicException |
418 | 418 | */ |
419 | - final public function offsetSet ($offset, $value) { |
|
419 | + final public function offsetSet($offset, $value) { |
|
420 | 420 | throw new LogicException('The schema cannot be altered this way.'); |
421 | 421 | } |
422 | 422 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @param $offset |
425 | 425 | * @throws LogicException |
426 | 426 | */ |
427 | - final public function offsetUnset ($offset) { |
|
427 | + final public function offsetUnset($offset) { |
|
428 | 428 | throw new LogicException('The schema cannot be altered this way.'); |
429 | 429 | } |
430 | 430 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @return Num |
435 | 435 | */ |
436 | - public function pi () { |
|
436 | + public function pi() { |
|
437 | 437 | return Num::factory($this, "PI()"); |
438 | 438 | } |
439 | 439 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @param array $options |
445 | 445 | * @return Statement |
446 | 446 | */ |
447 | - public function prepare ($sql, $options = []) { |
|
447 | + public function prepare($sql, $options = []) { |
|
448 | 448 | $this->logger->__invoke($sql); |
449 | 449 | /** @var Statement $statement */ |
450 | 450 | $statement = parent::prepare($sql, $options); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @param array $ctorargs Optional. |
461 | 461 | * @return Statement |
462 | 462 | */ |
463 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
463 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
464 | 464 | $this->logger->__invoke($sql); |
465 | 465 | /** @var Statement $statement */ |
466 | 466 | $statement = parent::query(...func_get_args()); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * @param int $type Ignored. |
479 | 479 | * @return string|ExpressionInterface |
480 | 480 | */ |
481 | - public function quote ($value, $type = self::PARAM_STR) { |
|
481 | + public function quote($value, $type = self::PARAM_STR) { |
|
482 | 482 | if ($value instanceof ExpressionInterface) { |
483 | 483 | return $value; |
484 | 484 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | * @param array $values |
499 | 499 | * @return string[] |
500 | 500 | */ |
501 | - public function quoteArray (array $values) { |
|
501 | + public function quoteArray(array $values) { |
|
502 | 502 | return array_map([$this, 'quote'], $values); |
503 | 503 | } |
504 | 504 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @param array $values |
509 | 509 | * @return string |
510 | 510 | */ |
511 | - public function quoteList (array $values): string { |
|
511 | + public function quoteList(array $values): string { |
|
512 | 512 | return implode(',', $this->quoteArray($values)); |
513 | 513 | } |
514 | 514 | |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return Num |
519 | 519 | */ |
520 | - public function rand () { |
|
520 | + public function rand() { |
|
521 | 521 | return Num::factory($this, "RAND()"); |
522 | 522 | } |
523 | 523 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return true |
530 | 530 | */ |
531 | - public function rollBack () { |
|
531 | + public function rollBack() { |
|
532 | 532 | assert($this->transactions > 0); |
533 | 533 | if ($this->transactions === 1) { |
534 | 534 | $this->logger->__invoke("ROLLBACK TRANSACTION"); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @param EntityInterface $entity |
549 | 549 | * @return int ID |
550 | 550 | */ |
551 | - public function save (EntityInterface $entity): int { |
|
551 | + public function save(EntityInterface $entity): int { |
|
552 | 552 | return $this->getRecord($entity)->save($entity); |
553 | 553 | } |
554 | 554 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * @param Junction $junction |
558 | 558 | * @return $this |
559 | 559 | */ |
560 | - public function setJunction (string $interface, Junction $junction) { |
|
560 | + public function setJunction(string $interface, Junction $junction) { |
|
561 | 561 | $this->junctions[$interface] = $junction; |
562 | 562 | return $this; |
563 | 563 | } |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @param Closure $logger |
567 | 567 | * @return $this |
568 | 568 | */ |
569 | - public function setLogger (Closure $logger) { |
|
569 | + public function setLogger(Closure $logger) { |
|
570 | 570 | $this->logger = $logger; |
571 | 571 | return $this; |
572 | 572 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * @param Record $record |
577 | 577 | * @return $this |
578 | 578 | */ |
579 | - public function setRecord (string $class, Record $record) { |
|
579 | + public function setRecord(string $class, Record $record) { |
|
580 | 580 | $this->records[$class] = $record; |
581 | 581 | return $this; |
582 | 582 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * @param callable[] $callbacks Keyed by function name. |
586 | 586 | * @param bool $deterministic Whether the callbacks aren't random / are without side-effects. |
587 | 587 | */ |
588 | - public function sqliteCreateFunctions (array $callbacks, bool $deterministic = true): void { |
|
588 | + public function sqliteCreateFunctions(array $callbacks, bool $deterministic = true): void { |
|
589 | 589 | $deterministic = $deterministic ? self::SQLITE_DETERMINISTIC : 0; |
590 | 590 | foreach ($callbacks as $name => $callback) { |
591 | 591 | $argc = (new ReflectionFunction($callback))->getNumberOfRequiredParameters(); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | * @param callable $work |
602 | 602 | * @return mixed The return value of `$work` |
603 | 603 | */ |
604 | - public function transact (callable $work) { |
|
604 | + public function transact(callable $work) { |
|
605 | 605 | $transaction = $this->newTransaction(); |
606 | 606 | $return = call_user_func($work); |
607 | 607 | $transaction->commit(); |
@@ -219,8 +219,7 @@ discard block |
||
219 | 219 | if ($this->transactions === 0) { |
220 | 220 | $this->logger->__invoke("BEGIN TRANSACTION"); |
221 | 221 | parent::beginTransaction(); |
222 | - } |
|
223 | - else { |
|
222 | + } else { |
|
224 | 223 | $this->exec("SAVEPOINT SAVEPOINT_{$this->transactions}"); |
225 | 224 | } |
226 | 225 | $this->transactions++; |
@@ -239,8 +238,7 @@ discard block |
||
239 | 238 | if ($this->transactions === 1) { |
240 | 239 | $this->logger->__invoke("COMMIT TRANSACTION"); |
241 | 240 | parent::commit(); |
242 | - } |
|
243 | - else { |
|
241 | + } else { |
|
244 | 242 | $savepoint = $this->transactions - 1; |
245 | 243 | $this->exec("RELEASE SAVEPOINT SAVEPOINT_{$savepoint}"); |
246 | 244 | } |
@@ -533,8 +531,7 @@ discard block |
||
533 | 531 | if ($this->transactions === 1) { |
534 | 532 | $this->logger->__invoke("ROLLBACK TRANSACTION"); |
535 | 533 | parent::rollBack(); |
536 | - } |
|
537 | - else { |
|
534 | + } else { |
|
538 | 535 | $savepoint = $this->transactions - 1; |
539 | 536 | $this->exec("ROLLBACK TO SAVEPOINT SAVEPOINT_{$savepoint}"); |
540 | 537 | } |