Completed
Push — master ( 69b50c...54bc95 )
by smiley
01:44
created
src/Query/Dialects/SQLite/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 
37 37
 		$sql  = 'SELECT ';
38 38
 		$sql .= $this->distinct ? 'DISTINCT ' : '';
39
-		$sql .= !empty($this->cols) ? implode($glue , $this->cols).PHP_EOL : '* ';
40
-		$sql .= 'FROM '.implode($glue , $this->from);
39
+		$sql .= !empty($this->cols) ? implode($glue, $this->cols).PHP_EOL : '* ';
40
+		$sql .= 'FROM '.implode($glue, $this->from);
41 41
 		$sql .= $this->_getWhere();
42 42
 		$sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : '';
43 43
 		$sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : '';
Please login to merge, or discard this patch.
tests/Query/QueryTestAbstract.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 		$insert
114 114
 			->into(self::TEST_TABLENAME)
115 115
 			->values([
116
-				['id' => 1, 'hash' => md5(1), 'data' => 'foo', 'value' => 123.456,    'active' => 0],
116
+				['id' => 1, 'hash' => md5(1), 'data' => 'foo', 'value' => 123.456, 'active' => 0],
117 117
 				['id' => 2, 'hash' => md5(2), 'data' => 'foo', 'value' => 123.456789, 'active' => 1],
118
-				['id' => 3, 'hash' => md5(3), 'data' => 'foo', 'value' => 123.456,    'active' => 0],
118
+				['id' => 3, 'hash' => md5(3), 'data' => 'foo', 'value' => 123.456, 'active' => 0],
119 119
 			])
120 120
 		;
121 121
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		$select = $this->statement->select;
172 172
 		$select
173 173
 			->from([self::TEST_TABLENAME])
174
-			->where('id', [1,2,3], 'in')
174
+			->where('id', [1, 2, 3], 'in')
175 175
 			->orderBy(['hash' => ['desc', 'lower']]);
176 176
 #		print_r(PHP_EOL.$select->sql().PHP_EOL);
177 177
 		$result = $select->execute();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 #		print_r(PHP_EOL.$update->sql().PHP_EOL);
214 214
 		$this->assertTrue($update->execute());
215 215
 
216
-		$r = $this->statement->select->from([self::TEST_TABLENAME])->where('id' ,1)->execute();
216
+		$r = $this->statement->select->from([self::TEST_TABLENAME])->where('id', 1)->execute();
217 217
 
218 218
 		$this->assertSame('bar', $r[0]->data);
219 219
 		$this->assertSame(42.42, (float)$r[0]->value);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		$this->assertTrue($delete->execute());
248 248
 
249 249
 		$r = $this->statement->select->from([self::TEST_TABLENAME])->execute();
250
-		$this->assertCount(3,  $r);
250
+		$this->assertCount(3, $r);
251 251
 	}
252 252
 
253 253
 	/**
Please login to merge, or discard this patch.
src/Query/Dialects/Firebird/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
 		$sql  = 'SELECT ';
44 44
 		$sql .= !is_null($this->limit) ? 'FIRST ? SKIP ? ' : '';
45 45
 		$sql .= $this->distinct ? 'DISTINCT ' : '';
46
-		$sql .= !empty($this->cols) ? implode($glue , $this->cols).PHP_EOL : '* ';
47
-		$sql .= 'FROM '.implode($glue , $this->from);
46
+		$sql .= !empty($this->cols) ? implode($glue, $this->cols).PHP_EOL : '* ';
47
+		$sql .= 'FROM '.implode($glue, $this->from);
48 48
 		$sql .= $this->_getWhere();
49 49
 		$sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : '';
50 50
 		$sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : '';
Please login to merge, or discard this patch.
src/Query/SelectAbstract.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 			if(is_string($k)){
119 119
 				is_array($ref)
120 120
 					? $this->addColumn($ref[0], $k, $ref[1] ?? null)
121
-					: $this->addColumn($ref ,$k);
121
+					: $this->addColumn($ref, $k);
122 122
 			}
123 123
 			else{
124 124
 				is_array($ref)
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$from = $this->quote($table);
141 141
 
142 142
 		if($ref){
143
-			$from = sprintf('%s AS %s', $this->quote($ref), $this->quote($table));// @todo: index hint
143
+			$from = sprintf('%s AS %s', $this->quote($ref), $this->quote($table)); // @todo: index hint
144 144
 		}
145 145
 
146 146
 		$this->from[$ref ?? $table] = $from;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 					$dir = strtoupper($expression[0]);
212 212
 
213 213
 					if(in_array($dir, ['ASC', 'DESC'])){
214
-						$this->orderby[] =  isset($expression[1]) ? strtoupper($expression[1]).'('.$this->quote($alias).') '.$dir : $dir;
214
+						$this->orderby[] = isset($expression[1]) ? strtoupper($expression[1]).'('.$this->quote($alias).') '.$dir : $dir;
215 215
 					}
216 216
 
217 217
 				}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 					$dir = strtoupper($expression);
220 220
 
221 221
 					if(in_array($dir, ['ASC', 'DESC'])){
222
-						$this->orderby[] =  $this->quote($alias).' '.$dir;
222
+						$this->orderby[] = $this->quote($alias).' '.$dir;
223 223
 					}
224 224
 
225 225
 				}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		$sql  = 'SELECT ';
266 266
 		$sql .= $this->distinct ? 'DISTINCT ' : '';
267 267
 		$sql .= 'COUNT(*) AS  '.$this->quote('count');
268
-		$sql .= 'FROM '.implode($glue , $this->from);
268
+		$sql .= 'FROM '.implode($glue, $this->from);
269 269
 		$sql .= $this->_getWhere();
270 270
 		$sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : '';
271 271
 
Please login to merge, or discard this patch.
src/Query/Dialects/MySQL/CreateTable.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			$sql .= ' ('.PHP_EOL."\t".implode(','.PHP_EOL."\t", $this->cols);
41 41
 
42 42
 			if($this->primaryKey){
43
-				$sql .=','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey).')';
43
+				$sql .= ','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey).')';
44 44
 			}
45 45
 
46 46
 			$sql .= PHP_EOL.')';
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		                  'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID'];
86 86
 
87 87
 		$field[] = (is_int($length) || is_string($length) && count(explode(',', $length)) === 2) && !in_array($type, $nolengthtypes)
88
-			? $type.'('. $length . ')'
88
+			? $type.'('.$length.')'
89 89
 			: $type;
90 90
 
91 91
 		if($attribute){
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 					$field[] = 'DEFAULT NULL';
130 130
 					break;
131 131
 				default:
132
-					$field[] = 'DEFAULT '.(is_int($defaultValue) || is_float($defaultValue) ? $defaultValue : '\''.$defaultValue.'\'') ;
132
+					$field[] = 'DEFAULT '.(is_int($defaultValue) || is_float($defaultValue) ? $defaultValue : '\''.$defaultValue.'\'');
133 133
 			}
134 134
 
135 135
 		}
Please login to merge, or discard this patch.
src/Query/CreateTableInterface.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,14 +77,14 @@
 block discarded – undo
77 77
 	 */
78 78
 #	public function index($name):CreateTableInterface;
79 79
 
80
-	public function tinyint(string $name, int $length = null,  $defaultValue = null , bool $isNull = null, string $attribute = null):CreateTableInterface;
81
-	public function int(string $name, int $length = null,  $defaultValue = null , bool $isNull = null, string $attribute = null):CreateTableInterface;
80
+	public function tinyint(string $name, int $length = null, $defaultValue = null, bool $isNull = null, string $attribute = null):CreateTableInterface;
81
+	public function int(string $name, int $length = null, $defaultValue = null, bool $isNull = null, string $attribute = null):CreateTableInterface;
82 82
 
83
-	public function tinytext(string $name,  $defaultValue = null , bool $isNull = true):CreateTableInterface;
84
-	public function text(string $name,  $defaultValue = null , bool $isNull = true):CreateTableInterface;
83
+	public function tinytext(string $name, $defaultValue = null, bool $isNull = true):CreateTableInterface;
84
+	public function text(string $name, $defaultValue = null, bool $isNull = true):CreateTableInterface;
85 85
 
86
-	public function varchar(string $name, int $length,  $defaultValue = null , bool $isNull = null):CreateTableInterface;
87
-	public function decimal(string $name, string $length,  $defaultValue = null , bool $isNull = null):CreateTableInterface;
88
-	public function enum(string $name, array $values, $defaultValue = null , bool $isNull = null):CreateTableInterface;
86
+	public function varchar(string $name, int $length, $defaultValue = null, bool $isNull = null):CreateTableInterface;
87
+	public function decimal(string $name, string $length, $defaultValue = null, bool $isNull = null):CreateTableInterface;
88
+	public function enum(string $name, array $values, $defaultValue = null, bool $isNull = null):CreateTableInterface;
89 89
 
90 90
 }
Please login to merge, or discard this patch.
src/Query/CreateTableAbstract.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return \chillerlan\Database\Query\CreateTableInterface
178 178
 	 */
179
-	public function tinyint(string $name, int $length = null,  $defaultValue = null , bool $isNull = null, string $attribute = null):CreateTableInterface{
179
+	public function tinyint(string $name, int $length = null, $defaultValue = null, bool $isNull = null, string $attribute = null):CreateTableInterface{
180 180
 		return $this->field($name, 'TINYINT', $length, $attribute, null, !is_null($defaultValue) ? false : $isNull, !is_null($defaultValue) ? 'USER_DEFINED' : null, $defaultValue);
181 181
 	}
182 182
 
183 183
 
184
-	public function int(string $name, int $length = null,  $defaultValue = null , bool $isNull = null, string $attribute = null):CreateTableInterface{
184
+	public function int(string $name, int $length = null, $defaultValue = null, bool $isNull = null, string $attribute = null):CreateTableInterface{
185 185
 		return $this->field($name, 'INT', $length, $attribute, null, !is_null($defaultValue) ? false : $isNull, !is_null($defaultValue) ? 'USER_DEFINED' : null, $defaultValue);
186 186
 	}
187 187
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return \chillerlan\Database\Query\CreateTableInterface
196 196
 	 */
197
-	public function varchar(string $name, int $length,  $defaultValue = null , bool $isNull = null):CreateTableInterface{
197
+	public function varchar(string $name, int $length, $defaultValue = null, bool $isNull = null):CreateTableInterface{
198 198
 		return $this->field($name, 'VARCHAR', $length, null, null, !is_null($defaultValue) ? false : $isNull, !is_null($defaultValue) ? 'USER_DEFINED' : null, $defaultValue);
199 199
 	}
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return \chillerlan\Database\Query\CreateTableInterface
208 208
 	 */
209
-	public function decimal(string $name, string $length,  $defaultValue = null , bool $isNull = null):CreateTableInterface{
209
+	public function decimal(string $name, string $length, $defaultValue = null, bool $isNull = null):CreateTableInterface{
210 210
 		return $this->field($name, 'DECIMAL', $length, null, null, !is_null($defaultValue) ? false : $isNull, !is_null($defaultValue) ? 'USER_DEFINED' : null, $defaultValue);
211 211
 	}
212 212
 
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return \chillerlan\Database\Query\CreateTableInterface
219 219
 	 */
220
-	public function tinytext(string $name,  $defaultValue = null , bool $isNull = true):CreateTableInterface{
220
+	public function tinytext(string $name, $defaultValue = null, bool $isNull = true):CreateTableInterface{
221 221
 		return $this->field($name, 'TINYTEXT', null, null, null, !is_null($defaultValue) ? false : $isNull, !is_null($defaultValue) ? 'USER_DEFINED' : null, $defaultValue);
222 222
 	}
223 223
 
224 224
 
225
-	public function text(string $name,  $defaultValue = null , bool $isNull = true):CreateTableInterface{
225
+	public function text(string $name, $defaultValue = null, bool $isNull = true):CreateTableInterface{
226 226
 		return $this->field($name, 'TEXT', null, null, null, !is_null($defaultValue) ? false : $isNull, !is_null($defaultValue) ? 'USER_DEFINED' : null, $defaultValue);
227 227
 	}
228 228
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return \chillerlan\Database\Query\CreateTableInterface
237 237
 	 */
238
-	public function enum(string $name, array $values, $defaultValue = null , bool $isNull = null):CreateTableInterface{
238
+	public function enum(string $name, array $values, $defaultValue = null, bool $isNull = null):CreateTableInterface{
239 239
 
240 240
 		$field = $this->quote($name);
241 241
 		$field .= 'ENUM (\''.implode('\', \'', $values).'\')';
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		}
246 246
 
247 247
 		if(in_array($defaultValue, $values, true)){
248
-			$field .= 'DEFAULT '.(is_int($defaultValue) || is_float($defaultValue) ? $defaultValue : '\''.$defaultValue.'\'') ;
248
+			$field .= 'DEFAULT '.(is_int($defaultValue) || is_float($defaultValue) ? $defaultValue : '\''.$defaultValue.'\'');
249 249
 		}
250 250
 		elseif($isNull && strtolower($defaultValue) === 'null'){
251 251
 			$field .= 'DEFAULT NULL';
Please login to merge, or discard this patch.