Passed
Push — master ( 97f11f...b3f1b0 )
by Fabio
17:49
created
framework/Util/TDbLogRoute.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			$command->bindValue(':category', $log[TLogger::LOG_CATEGORY]);
127 127
 			$command->bindValue(':prefix', $this->getLogPrefix($log));
128 128
 			$command->bindValue(':logtime', sprintf('%F', $log[TLogger::LOG_TIME]));
129
-			if(!$command->execute()) {
129
+			if (!$command->execute()) {
130 130
 				throw new TLogException('dblogroute_insert_failed', $this->_logTable);
131 131
 			}
132 132
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return string The where clause for the various SQL statements.
147 147
 	 * @since 4.3.0
148 148
 	 */
149
-	protected function getLogWhere(?int $level, null|string|array $categories, ?float $minTime, ?float $maxTime, &$values): string
149
+	protected function getLogWhere(?int $level, null | string | array $categories, ?float $minTime, ?float $maxTime, &$values): string
150 150
 	{
151 151
 		$where = '';
152 152
 		$values = [];
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 			$values[':level'] = $level;
156 156
 		}
157 157
 		if ($categories !== null) {
158
-			if(is_string($categories)) {
158
+			if (is_string($categories)) {
159 159
 				$categories = array_map('trim', explode(',', $categories));
160 160
 			}
161 161
 			$i = 0;
162 162
 			$or = '';
163
-			foreach($categories as $category) {
163
+			foreach ($categories as $category) {
164 164
 				$c = $category[0] ?? 0;
165 165
 				if ($c === '!' || $c === '~') {
166 166
 					if ($where) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return string The where clause for the various SQL statements..
215 215
 	 * @since 4.3.0
216 216
 	 */
217
-	public function getDBLogCount(?int $level = null, null|string|array $categories = null, ?float $minTime = null, ?float $maxTime = null)
217
+	public function getDBLogCount(?int $level = null, null | string | array $categories = null, ?float $minTime = null, ?float $maxTime = null)
218 218
 	{
219 219
 		$values = [];
220 220
 		$where = $this->getLogWhere($level, $categories, $minTime, $maxTime, $values);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return \Prado\Data\TDbDataReader the logs from the database.
239 239
 	 * @since 4.3.0
240 240
 	 */
241
-	public function getDBLogs(?int $level = null, null|string|array $categories = null, ?float $minTime = null, ?float $maxTime = null, string $order = '', string $limit = '')
241
+	public function getDBLogs(?int $level = null, null | string | array $categories = null, ?float $minTime = null, ?float $maxTime = null, string $order = '', string $limit = '')
242 242
 	{
243 243
 		$values = [];
244 244
 		if ($order) {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @return int the number of logs in the database.
267 267
 	 * @since 4.3.0
268 268
 	 */
269
-	public function deleteDBLog(?int $level = null, null|string|array $categories = null, ?float $minTime = null, ?float $maxTime = null)
269
+	public function deleteDBLog(?int $level = null, null | string | array $categories = null, ?float $minTime = null, ?float $maxTime = null)
270 270
 	{
271 271
 		$values = [];
272 272
 		$where = $this->getLogWhere($level, $categories, $minTime, $maxTime, $values);
Please login to merge, or discard this patch.
framework/Util/TLogger.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function __construct(bool $flushShutdown = true)
144 144
 	{
145
-		if($flushShutdown) {
146
-			register_shutdown_function(function () {
145
+		if ($flushShutdown) {
146
+			register_shutdown_function(function() {
147 147
 				$this->onFlushLogs();
148 148
 				// flush any logs in the shutdown function.
149 149
 				register_shutdown_function([$this, 'onFlushLogs'], $this, true);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return int The number of logs.
215 215
 	 * @since 4.3.0
216 216
 	 */
217
-	public function getLogCount(null|bool|int $selector = null): int
217
+	public function getLogCount(null | bool | int $selector = null): int
218 218
 	{
219 219
 		if ($selector === null) {// logs @TLogRoute::processLogs after removing logged elements.
220 220
 			return count($this->_logs) + $this->_profileLogsCount;
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 			return;
410 410
 		}
411 411
 
412
-		if(is_bool($sender)) {
412
+		if (is_bool($sender)) {
413 413
 			$final = $sender;
414 414
 			$sender = null;
415 415
 		}
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
 		$this->deleteLogs();
425 425
 		$this->_flushing = false;
426 426
 		if (count($this->_flushingLog)) {
427
-			foreach($this->_flushingLog as $log) {
427
+			foreach ($this->_flushingLog as $log) {
428 428
 				$this->addLog($log, false); // $final = false to stop any possible recursion w/ low flushCount.
429 429
 			}
430 430
 		}
431 431
 		$this->_flushingLog = null;
432 432
 
433 433
 		$this->_profileLogsCount = 0;
434
-		foreach(array_keys($this->_profileLogs) as $key) {
434
+		foreach (array_keys($this->_profileLogs) as $key) {
435 435
 			$this->_profileLogs[$key][static::LOG_LEVEL] |= static::LOGGED;
436 436
 		}
437 437
 	}
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 *   [6] => traces, when configured; null when absent
475 475
 	 *   [7] => process id)
476 476
 	 */
477
-	public function getLogs(?int $levels = null, null|array|string $categories = null, null|array|string $controls = null, null|int|float $timestamp = null, ?int $pid = null)
477
+	public function getLogs(?int $levels = null, null | array | string $categories = null, null | array | string $controls = null, null | int | float $timestamp = null, ?int $pid = null)
478 478
 	{
479 479
 		$this->_levels = $levels;
480 480
 		if (!empty($categories) && !is_array($categories)) {
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 	public function mergeLogs(array $logs)
524 524
 	{
525 525
 		$count = count($logs);
526
-		foreach($logs as $log) {
526
+		foreach ($logs as $log) {
527 527
 			$log[static::LOG_LEVEL] &= ~TLogger::LOGGED;
528 528
 			$this->addLog($log, !(--$count));
529 529
 		}
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	 * @param ?int $pid
557 557
 	 * @return array The logs being delete are returned.
558 558
 	 */
559
-	public function deleteLogs(?int $levels = null, null|string|array $categories = null, null|string|array $controls = null, null|int|float $timestamp = null, ?int $pid = null): array
559
+	public function deleteLogs(?int $levels = null, null | string | array $categories = null, null | string | array $controls = null, null | int | float $timestamp = null, ?int $pid = null): array
560 560
 	{
561 561
 		$this->_levels = $levels;
562 562
 		if (!empty($categories) && !is_array($categories)) {
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 			}
641 641
 			$c = $category[0] ?? 0;
642 642
 			if ($c === '!' || $c === '~') {
643
-				if(!$exclude) {
643
+				if (!$exclude) {
644 644
 					$category = substr($category, 1);
645 645
 					if ($log[static::LOG_CATEGORY] === $category || str_ends_with($category, '*') && strpos($log[static::LOG_CATEGORY], rtrim($category, '*')) === 0) {
646 646
 						$exclude = true;
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			}
698 698
 			$c = $control[0] ?? 0;
699 699
 			if ($c === '!' || $c === '~') {
700
-				if(!$exclude) {
700
+				if (!$exclude) {
701 701
 					$control = substr($control, 1);
702 702
 					if ($log[static::LOG_CONTROL] === $control || str_ends_with($control, '*') && strpos($log[static::LOG_CONTROL], rtrim($control, '*')) === 0) {
703 703
 						$exclude = true;
Please login to merge, or discard this patch.