Completed
Pull Request — master (#1134)
by John
30s
created
lib/Tools/Db/ExtendedQueryBuilder.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function limitToCreation(int $delay = 0): self {
218 218
 		$date = new DateTime('now');
219
-		$date->sub(new DateInterval('PT' . $delay . 'M'));
219
+		$date->sub(new DateInterval('PT'.$delay.'M'));
220 220
 
221 221
 		$this->limitToDBFieldDateTime('creation', $date, true);
222 222
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		$expr = $this->expr();
234 234
 		$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias()
235 235
 																. '.' : '';
236
-		$field = $pf . $field;
236
+		$field = $pf.$field;
237 237
 
238 238
 		$orX = $expr->orX();
239 239
 		$orX->add(
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 
265 265
 		$expr = $this->expr();
266
-		$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias() . '.' : '';
267
-		$field = $pf . $field;
266
+		$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias().'.' : '';
267
+		$field = $pf.$field;
268 268
 
269 269
 		$orX = $expr->orX();
270 270
 		$orX->add(
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	public function searchInDBField(string $field, string $value): void {
283 283
 		$expr = $this->expr();
284 284
 
285
-		$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias() . '.' : '';
286
-		$field = $pf . $field;
285
+		$pf = ($this->getType() === DBALQueryBuilder::SELECT) ? $this->getDefaultSelectAlias().'.' : '';
286
+		$field = $pf.$field;
287 287
 
288 288
 		$this->andWhere($expr->iLike($field, $this->createNamedParameter($value)));
289 289
 	}
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 */
406 406
 	public function exprLike(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
407 407
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
408
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
408
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
409 409
 		}
410 410
 
411 411
 		$expr = $this->expr();
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
 	public function exprLimit(string $field, string $value, string $alias = '', bool $cs = true): string {
420 420
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
421
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
421
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
422 422
 		}
423 423
 
424 424
 		$expr = $this->expr();
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
 	public function exprLimitInt(string $field, int $value, string $alias = ''): IQueryFunction {
438 438
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
439
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
439
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
440 440
 		}
441 441
 
442 442
 		$expr = $this->expr();
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	public function exprLimitBool(string $field, bool $value, string $alias = ''): IQueryFunction {
456 456
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
457
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
457
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
458 458
 		}
459 459
 
460 460
 		$expr = $this->expr();
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		string $alias = ''
476 476
 	): ICompositeExpression {
477 477
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
478
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
478
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
479 479
 		}
480 480
 
481 481
 		$expr = $this->expr();
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		string $alias = ''
502 502
 	): ICompositeExpression {
503 503
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
504
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
504
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
505 505
 		}
506 506
 
507 507
 		$expr = $this->expr();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		bool $cs = true
531 531
 	): ICompositeExpression {
532 532
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
533
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
533
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
534 534
 		}
535 535
 
536 536
 		$andX = $this->expr()->andX();
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	 */
556 556
 	public function exprLimitInArray(string $field, array $values, string $alias = ''): IQueryFunction {
557 557
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
558
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
558
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
559 559
 		}
560 560
 
561 561
 		$expr = $this->expr();
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 	 */
574 574
 	public function exprLimitBitwise(string $field, int $flag, string $alias = ''): IQueryFunction {
575 575
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
576
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
576
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
577 577
 		}
578 578
 
579 579
 		$expr = $this->expr();
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 	 */
596 596
 	public function exprLt(string $field, int $value, bool $lte = false, string $alias = ''): IQueryFunction {
597 597
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
598
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
598
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
599 599
 		}
600 600
 
601 601
 		$expr = $this->expr();
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 */
618 618
 	public function exprGt(string $field, int $value, bool $gte = false, string $alias = ''): IQueryFunction {
619 619
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
620
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
620
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
621 621
 		}
622 622
 
623 623
 		$expr = $this->expr();
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	 */
727 727
 	public function exprUnlike(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
728 728
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
729
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
729
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
730 730
 		}
731 731
 
732 732
 		$expr = $this->expr();
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 	 */
751 751
 	public function exprFilter(string $field, string $value, string $alias = '', bool $cs = true): IQueryFunction {
752 752
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
753
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
753
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
754 754
 		}
755 755
 
756 756
 		$expr = $this->expr();
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	public function exprFilterInt(string $field, int $value, string $alias = ''): IQueryFunction {
778 778
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
779
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
779
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
780 780
 		}
781 781
 
782 782
 		$expr = $this->expr();
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 	 */
795 795
 	public function exprFilterBool(string $field, bool $value, string $alias = ''): IQueryFunction {
796 796
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
797
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
797
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
798 798
 		}
799 799
 
800 800
 		$expr = $this->expr();
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 		string $alias = ''
816 816
 	): ICompositeExpression {
817 817
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
818
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
818
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
819 819
 		}
820 820
 
821 821
 		$expr = $this->expr();
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 		string $alias = ''
842 842
 	): ICompositeExpression {
843 843
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
844
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
844
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
845 845
 		}
846 846
 
847 847
 		$expr = $this->expr();
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		bool $cs = true
871 871
 	): ICompositeExpression {
872 872
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
873
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
873
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
874 874
 		}
875 875
 
876 876
 		$orX = $this->expr()->orX();
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 	 */
896 896
 	public function exprFilterInArray(string $field, array $values, string $alias = ''): IQueryFunction {
897 897
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
898
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
898
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
899 899
 		}
900 900
 
901 901
 		$expr = $this->expr();
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 	 */
914 914
 	public function exprFilterBitwise(string $field, int $flag, string $alias = ''): IQueryFunction {
915 915
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
916
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
916
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
917 917
 		}
918 918
 
919 919
 		$expr = $this->expr();
@@ -1074,12 +1074,12 @@  discard block
 block discarded – undo
1074 1074
 		string $alias = ''
1075 1075
 	): self {
1076 1076
 		$selectFields = array_map(
1077
-			function (string $item) use ($alias) {
1077
+			function(string $item) use ($alias) {
1078 1078
 				if ($alias === '') {
1079 1079
 					return $item;
1080 1080
 				}
1081 1081
 
1082
-				return $alias . '.' . $item;
1082
+				return $alias.'.'.$item;
1083 1083
 			}, $fields
1084 1084
 		);
1085 1085
 
@@ -1105,13 +1105,13 @@  discard block
 block discarded – undo
1105 1105
 		string $prefix,
1106 1106
 		array $default = []
1107 1107
 	): self {
1108
-		$prefix = trim($prefix) . '_';
1108
+		$prefix = trim($prefix).'_';
1109 1109
 		foreach ($default as $k => $v) {
1110
-			$this->addDefaultValue($prefix . $k, (string)$v);
1110
+			$this->addDefaultValue($prefix.$k, (string)$v);
1111 1111
 		}
1112 1112
 
1113 1113
 		foreach ($fields as $field) {
1114
-			$this->selectAlias($alias . '.' . $field, $prefix . $field);
1114
+			$this->selectAlias($alias.'.'.$field, $prefix.$field);
1115 1115
 		}
1116 1116
 
1117 1117
 		return $this;
Please login to merge, or discard this patch.