Completed
Pull Request — master (#173)
by Maxence
54s
created
lib/Tools/Traits/TStringTools.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			return $line;
97 97
 		}
98 98
 
99
-		return substr($line, 0, $length - 5) . ' (..)';
99
+		return substr($line, 0, $length - 5).' (..)';
100 100
 	}
101 101
 
102 102
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	protected function feedStringWithParams(string $line, array $params): string {
135 135
 		$ak = array_keys($params);
136 136
 		foreach ($ak as $k) {
137
-			$line = str_replace('{' . $k . '}', (string)$params[$k], $line);
137
+			$line = str_replace('{'.$k.'}', (string)$params[$k], $line);
138 138
 		}
139 139
 
140 140
 		return $line;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$s = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
189 189
 		$e = floor(log($bytes, 1024));
190 190
 
191
-		return round($bytes / pow(1024, $e), 2) . ' ' . $s[$e];
191
+		return round($bytes / pow(1024, $e), 2).' '.$s[$e];
192 192
 	}
193 193
 
194 194
 
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 			$second = time();
212 212
 		}
213 213
 
214
-		$f = new DateTime('@' . $first);
215
-		$s = new DateTime('@' . $second);
214
+		$f = new DateTime('@'.$first);
215
+		$s = new DateTime('@'.$second);
216 216
 		$duration = $second - $first;
217 217
 		if ($short) {
218 218
 			$minutes = $this->get('minutes', $words, 'M');
@@ -220,16 +220,16 @@  discard block
 block discarded – undo
220 220
 			$days = $this->get('days', $words, 'D');
221 221
 
222 222
 			if ($duration < 60) {
223
-				return $f->diff($s)->format('<1' . $minutes);
223
+				return $f->diff($s)->format('<1'.$minutes);
224 224
 			}
225 225
 			if ($duration < 3600) {
226
-				return $f->diff($s)->format('%i' . $minutes);
226
+				return $f->diff($s)->format('%i'.$minutes);
227 227
 			}
228 228
 			if ($duration < 86400) {
229
-				return $f->diff($s)->format('%h' . $hours . ', %i' . $minutes);
229
+				return $f->diff($s)->format('%h'.$hours.', %i'.$minutes);
230 230
 			}
231 231
 
232
-			return $f->diff($s)->format('%a' . $days . ', %h' . $hours . ', %i' . $minutes);
232
+			return $f->diff($s)->format('%a'.$days.', %h'.$hours.', %i'.$minutes);
233 233
 		}
234 234
 
235 235
 		$seconds = $this->get('seconds', $words, 'seconds');
@@ -237,22 +237,22 @@  discard block
 block discarded – undo
237 237
 		$hours = $this->get('hours', $words, 'hours');
238 238
 		$days = $this->get('days', $words, 'days');
239 239
 		if ($duration < 60) {
240
-			return $f->diff($s)->format('%s ' . $seconds);
240
+			return $f->diff($s)->format('%s '.$seconds);
241 241
 		}
242 242
 
243 243
 		if ($duration < 3600) {
244
-			return $f->diff($s)->format('%i ' . $minutes . ' and %s ' . $seconds);
244
+			return $f->diff($s)->format('%i '.$minutes.' and %s '.$seconds);
245 245
 		}
246 246
 
247 247
 		if ($duration < 86400) {
248
-			return $f->diff($s)->format('%h ' . $hours . ', %i ' . $minutes . ' and %s ' . $seconds);
248
+			return $f->diff($s)->format('%h '.$hours.', %i '.$minutes.' and %s '.$seconds);
249 249
 		}
250 250
 
251 251
 		return $f->diff($s)->format(
252
-			'%a ' . $days .
253
-			', %h ' . $hours .
254
-			', %i ' . $minutes .
255
-			' and %s ' . $seconds
252
+			'%a '.$days.
253
+			', %h '.$hours.
254
+			', %i '.$minutes.
255
+			' and %s '.$seconds
256 256
 		);
257 257
 	}
258 258
 }
Please login to merge, or discard this patch.
lib/Tools/Traits/TNCLogger.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @param array $serializable
129 129
 	 */
130 130
 	public function emergency(string $message, bool $trace = false, array $serializable = []): void {
131
-		$this->log(self::$EMERGENCY, '[emergency] ' . $message, $trace, $serializable);
131
+		$this->log(self::$EMERGENCY, '[emergency] '.$message, $trace, $serializable);
132 132
 	}
133 133
 
134 134
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param array $serializable
138 138
 	 */
139 139
 	public function alert(string $message, bool $trace = false, array $serializable = []): void {
140
-		$this->log(self::$ALERT, '[alert] ' . $message, $trace, $serializable);
140
+		$this->log(self::$ALERT, '[alert] '.$message, $trace, $serializable);
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param array $serializable
147 147
 	 */
148 148
 	public function warning(string $message, bool $trace = false, array $serializable = []): void {
149
-		$this->log(self::$WARNING, '[warning] ' . $message, $trace, $serializable);
149
+		$this->log(self::$WARNING, '[warning] '.$message, $trace, $serializable);
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param array $serializable
156 156
 	 */
157 157
 	public function notice(string $message, bool $trace = false, array $serializable = []): void {
158
-		$this->log(self::$NOTICE, '[notice] ' . $message, $trace, $serializable);
158
+		$this->log(self::$NOTICE, '[notice] '.$message, $trace, $serializable);
159 159
 	}
160 160
 
161 161
 	/**
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param array $serializable
164 164
 	 */
165 165
 	public function debug(string $message, array $serializable = []): void {
166
-		$message = '[debug] ' . $message;
166
+		$message = '[debug] '.$message;
167 167
 		$debugLevel = (int)$this->appConfig('debug_level');
168 168
 		$this->log($debugLevel, $message, ($this->appConfig('debug_trace') === '1'), $serializable);
169 169
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		if ($trace) {
181 181
 			$opts['exception'] = new HintException($message, json_encode($serializable));
182 182
 		} elseif (!empty($serializable)) {
183
-			$message .= ' -- ' . json_encode($serializable);
183
+			$message .= ' -- '.json_encode($serializable);
184 184
 		}
185 185
 
186 186
 		$this->logger()
Please login to merge, or discard this patch.
lib/Tools/Traits/TArrayTools.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		foreach ($keys as $key) {
405 405
 			if (!array_key_exists($key, $arr)) {
406 406
 				throw new MalformedArrayException(
407
-					'source: ' . json_encode($arr) . ' - missing key: ' . $key
407
+					'source: '.json_encode($arr).' - missing key: '.$key
408 408
 				);
409 409
 			}
410 410
 		}
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	protected function cleanArray(array &$arr) {
418 418
 		$arr = array_filter(
419 419
 			$arr,
420
-			function ($v) {
420
+			function($v) {
421 421
 				if (is_string($v)) {
422 422
 					return ($v !== '');
423 423
 				}
Please login to merge, or discard this patch.
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();
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 */
427 427
 	public function exprLimit(string $field, string $value, string $alias = '', bool $cs = true): string {
428 428
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
429
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
429
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
430 430
 		}
431 431
 
432 432
 		$expr = $this->expr();
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	public function exprLimitInt(string $field, int $value, string $alias = ''): string {
454 454
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
455
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
455
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
456 456
 		}
457 457
 
458 458
 		$expr = $this->expr();
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 */
471 471
 	public function exprLimitBool(string $field, bool $value, string $alias = ''): string {
472 472
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
473
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
473
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
474 474
 		}
475 475
 
476 476
 		$expr = $this->expr();
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 		string $alias = ''
492 492
 	): ICompositeExpression {
493 493
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
494
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
494
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
495 495
 		}
496 496
 
497 497
 		$expr = $this->expr();
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		string $alias = ''
518 518
 	): ICompositeExpression {
519 519
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
520
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
520
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
521 521
 		}
522 522
 
523 523
 		$expr = $this->expr();
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		bool $cs = true
547 547
 	): ICompositeExpression {
548 548
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
549
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
549
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
550 550
 		}
551 551
 
552 552
 		$andX = $this->expr()->andX();
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 	 */
572 572
 	public function exprLimitInArray(string $field, array $values, string $alias = ''): string {
573 573
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
574
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
574
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
575 575
 		}
576 576
 
577 577
 		$expr = $this->expr();
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 	 */
590 590
 	public function exprLimitBitwise(string $field, int $flag, string $alias = ''): string {
591 591
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
592
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
592
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
593 593
 		}
594 594
 
595 595
 		$expr = $this->expr();
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	 */
612 612
 	public function exprLt(string $field, int $value, bool $lte = false, string $alias = ''): string {
613 613
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
614
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
614
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
615 615
 		}
616 616
 
617 617
 		$expr = $this->expr();
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 */
634 634
 	public function exprGt(string $field, int $value, bool $gte = false, string $alias = ''): string {
635 635
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
636
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
636
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
637 637
 		}
638 638
 
639 639
 		$expr = $this->expr();
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	 */
743 743
 	public function exprUnlike(string $field, string $value, string $alias = '', bool $cs = true): string {
744 744
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
745
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
745
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
746 746
 		}
747 747
 
748 748
 		$expr = $this->expr();
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	 */
767 767
 	public function exprFilter(string $field, string $value, string $alias = '', bool $cs = true): string {
768 768
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
769
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
769
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
770 770
 		}
771 771
 
772 772
 		$expr = $this->expr();
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	 */
793 793
 	public function exprFilterInt(string $field, int $value, string $alias = ''): string {
794 794
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
795
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
795
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
796 796
 		}
797 797
 
798 798
 		$expr = $this->expr();
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 */
811 811
 	public function exprFilterBool(string $field, bool $value, string $alias = ''): string {
812 812
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
813
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
813
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
814 814
 		}
815 815
 
816 816
 		$expr = $this->expr();
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 		string $alias = ''
832 832
 	): ICompositeExpression {
833 833
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
834
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
834
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
835 835
 		}
836 836
 
837 837
 		$expr = $this->expr();
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 		string $alias = ''
858 858
 	): ICompositeExpression {
859 859
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
860
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
860
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
861 861
 		}
862 862
 
863 863
 		$expr = $this->expr();
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 		bool $cs = true
887 887
 	): ICompositeExpression {
888 888
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
889
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
889
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
890 890
 		}
891 891
 
892 892
 		$orX = $this->expr()->orX();
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 	 */
912 912
 	public function exprFilterInArray(string $field, array $values, string $alias = ''): string {
913 913
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
914
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
914
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
915 915
 		}
916 916
 
917 917
 		$expr = $this->expr();
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	public function exprFilterBitwise(string $field, int $flag, string $alias = ''): string {
931 931
 		if ($this->getType() === DBALQueryBuilder::SELECT) {
932
-			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field;
932
+			$field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias).'.'.$field;
933 933
 		}
934 934
 
935 935
 		$expr = $this->expr();
@@ -1090,12 +1090,12 @@  discard block
 block discarded – undo
1090 1090
 		string $alias = ''
1091 1091
 	): self {
1092 1092
 		$selectFields = array_map(
1093
-			function (string $item) use ($alias) {
1093
+			function(string $item) use ($alias) {
1094 1094
 				if ($alias === '') {
1095 1095
 					return $item;
1096 1096
 				}
1097 1097
 
1098
-				return $alias . '.' . $item;
1098
+				return $alias.'.'.$item;
1099 1099
 			}, $fields
1100 1100
 		);
1101 1101
 
@@ -1121,13 +1121,13 @@  discard block
 block discarded – undo
1121 1121
 		string $prefix,
1122 1122
 		array $default = []
1123 1123
 	): self {
1124
-		$prefix = trim($prefix) . '_';
1124
+		$prefix = trim($prefix).'_';
1125 1125
 		foreach ($default as $k => $v) {
1126
-			$this->addDefaultValue($prefix . $k, (string)$v);
1126
+			$this->addDefaultValue($prefix.$k, (string)$v);
1127 1127
 		}
1128 1128
 
1129 1129
 		foreach ($fields as $field) {
1130
-			$this->selectAlias($alias . '.' . $field, $prefix . $field);
1130
+			$this->selectAlias($alias.'.'.$field, $prefix.$field);
1131 1131
 		}
1132 1132
 
1133 1133
 		return $this;
Please login to merge, or discard this patch.