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