Passed
Push — main ( beb9e1...43b6a1 )
by Dimitri
25:37 queued 20:48
created
src/View/Parser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
         $file = $this->viewPath . $view;
99 99
 
100
-        if (! is_file($file)) {
100
+        if (!is_file($file)) {
101 101
             $fileOrig = $file;
102 102
             $file     = ($this->locator ?: Services::locator())->locateFile($view, 'Views');
103 103
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function setData(array $data = [], ?string $context = null): static
173 173
     {
174
-        if (! empty($context)) {
174
+        if (!empty($context)) {
175 175
             foreach ($data as $key => &$value) {
176 176
                 if (is_array($value)) {
177 177
                     foreach ($value as &$obj) {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         foreach ($matches as $match) {
282 282
             // Loop over each piece of $data, replacing
283 283
             // its contents so that we know what to replace in parse()
284
-            $str = '';  // holds the new contents for this tag pair.
284
+            $str = ''; // holds the new contents for this tag pair.
285 285
 
286 286
             foreach ($data as $row) {
287 287
                 // Objects that have a `toArray()` method should be
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                     if (is_array($val)) {
304 304
                         $pair = $this->parsePair($key, $val, $match[1]);
305 305
 
306
-                        if (! empty($pair)) {
306
+                        if (!empty($pair)) {
307 307
                             $pairs[array_keys($pair)[0]] = true;
308 308
 
309 309
                             $temp = array_merge($temp, $pair);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
                 // Now replace our placeholders with the new content.
325 325
                 foreach ($temp as $pattern => $content) {
326
-                    $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern]));
326
+                    $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern]));
327 327
                 }
328 328
 
329 329
                 $str .= $out;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     protected function replaceSingle(array|string $pattern, string $content, string $template, bool $escape = false): string
482 482
     {
483 483
         // Replace the content in the template
484
-        return preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
484
+        return preg_replace_callback($pattern, function($matches) use ($content, $escape) {
485 485
             // Check for {! !} syntax to not escape this one.
486 486
             if (
487 487
                 str_starts_with($matches[0], $this->leftDelimiter . '!')
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 
504 504
         // Our regex earlier will leave all chained values on a single line
505 505
         // so we need to break them apart so we can apply them all.
506
-        $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : [];
506
+        $filters = !empty($matches[1]) ? explode('|', $matches[1]) : [];
507 507
 
508 508
         if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) {
509 509
             $filters[] = "esc({$context})";
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
             }
532 532
         }
533 533
         // No pipes, then we know we need to escape
534
-        elseif (! str_contains($key, '|')) {
534
+        elseif (!str_contains($key, '|')) {
535 535
             $escape = 'html';
536 536
         }
537 537
         // If there's a `noescape` then we're definitely false.
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             $escape = false;
540 540
         }
541 541
         // If no `esc` filter is found, then we'll need to add one.
542
-        elseif (! preg_match('/\s+esc/u', $key)) {
542
+        elseif (!preg_match('/\s+esc/u', $key)) {
543 543
             $escape = 'html';
544 544
         }
545 545
 
@@ -558,10 +558,10 @@  discard block
 block discarded – undo
558 558
             preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/u', $filter, $param);
559 559
 
560 560
             // Remove the () and spaces to we have just the parameter left
561
-            $param = ! empty($param) ? trim($param[0], '() ') : null;
561
+            $param = !empty($param) ? trim($param[0], '() ') : null;
562 562
 
563 563
             // Params can be separated by commas to allow multiple parameters for the filter
564
-            if (! empty($param)) {
564
+            if (!empty($param)) {
565 565
                 $param = explode(',', $param);
566 566
 
567 567
                 // Clean it up
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
             }
574 574
 
575 575
             // Get our filter name
576
-            $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
576
+            $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
577 577
 
578 578
             $this->config['filters'] ??= [];
579
-            if (! array_key_exists($filter, $this->config['filters'])) {
579
+            if (!array_key_exists($filter, $this->config['filters'])) {
580 580
                 continue;
581 581
             }
582 582
 
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
              *   $matches[1] = all parameters string in opening tag
614 614
              *   $matches[2] = content between the tags to send to the plugin.
615 615
              */
616
-            if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
616
+            if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
617 617
                 continue;
618 618
             }
619 619
 
Please login to merge, or discard this patch.