Passed
Push — master ( 7a93b3...3ce8fa )
by Nicolaas
05:19 queued 40s
created
src/Api/SearchApi.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
     public function setBypassCanMethods(bool $b): SearchApi
172 172
     {
173
-        if (! Director::is_cli()) {
173
+        if (!Director::is_cli()) {
174 174
             user_error('setBypassCanMethods() is only available in CLI mode. Use with caution as it will bypass all canView() and canEdit() checks.', E_USER_WARNING);
175 175
         } else {
176 176
             $this->bypassCanMethods = $b;
@@ -301,13 +301,13 @@  discard block
 block discarded – undo
301 301
                     $className = $item->ClassName;
302 302
                     $fields = $this->getAllValidFields($className);
303 303
                     foreach ($fields as $field) {
304
-                        if (! $item->{$field} || ! is_string($item->{$field})) {
304
+                        if (!$item->{$field} || !is_string($item->{$field})) {
305 305
                             continue;
306 306
                         }
307 307
                         if (strpos($item->{$field}, $word) === false) {
308 308
                             continue;
309 309
                         }
310
-                        if (! $this->includeFieldTest($className, $field)) {
310
+                        if (!$this->includeFieldTest($className, $field)) {
311 311
                             continue;
312 312
                         }
313 313
                         if ($type === 'url') {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
                         if ($this->showReplacements) {
329 329
                             DB::alteration_message(
330 330
                                 '.... .... ' . $dryRunNote .
331
-                                    $item->ClassName . '.' .  $item->ID .
331
+                                    $item->ClassName . '.' . $item->ID .
332 332
                                     ' replace ' . $word . ' with ' . $replace .
333 333
                                     ' (' . $type . ') in field ' . $field,
334 334
                                 'changed'
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             $myStage = Versioned::get_stage();
372 372
             Versioned::set_stage(Versioned::DRAFT);
373 373
             // is it on live and is live the same as draft
374
-            $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft();
374
+            $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft();
375 375
             $item->writeToStage(Versioned::DRAFT);
376 376
             if ($canBePublished) {
377 377
                 $item->publishSingle();
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
         if (count($this->words) > 0) {
406 406
             foreach ($this->getAllDataObjects() as $className) {
407
-                if (! $this->includeClassTest($className)) {
407
+                if (!$this->includeClassTest($className)) {
408 408
                     continue;
409 409
                 }
410 410
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                 $fields = $this->getAllValidFields($className);
413 413
                 $filterAny = [];
414 414
                 foreach ($fields as $field) {
415
-                    if (! $this->includeFieldTest($className, $field)) {
415
+                    if (!$this->includeFieldTest($className, $field)) {
416 416
                         continue;
417 417
                     }
418 418
                     $filterAny[$field . ':PartialMatch'] = $this->words;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         $back = $this->config()->get('hours_back_for_recent') ?: 24;
462 462
         $limit = $this->Config()->get('limit_per_class_for_recent') ?: 5;
463 463
         $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp());
464
-        if (! $threshold) {
464
+        if (!$threshold) {
465 465
             $threshold = time() - 86400;
466 466
         }
467 467
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         }
568 568
         $finder->saveCache();
569 569
 
570
-        if (! empty($this->sortOverride)) {
570
+        if (!empty($this->sortOverride)) {
571 571
             return $list->sort($this->sortOverride);
572 572
         } else {
573 573
             return $list->sort(['SiteWideSearchSortValue' => 'ASC']);
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
             $testWords = array_unique($testWords);
598 598
             foreach ($testWords as $wordKey => $word) {
599 599
                 //match a exact field to full words / one word
600
-                $fullWords = ! (bool) $wordKey;
600
+                $fullWords = !(bool) $wordKey;
601 601
                 if (false === $done) {
602 602
                     $count = 0;
603 603
                     foreach ($fieldValues as $fieldValue) {
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 
716 716
     protected function includeClassTest(string $className): bool
717 717
     {
718
-        if (count($this->includedClassesWithSubClassess) && ! in_array($className, $this->includedClassesWithSubClassess, true)) {
718
+        if (count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) {
719 719
             if ($this->debug) {
720 720
                 DB::alteration_message(' ... Skipping as not included ' . $className);
721 721
             }
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         } elseif (count($this->includedFields) > 0) {
742 742
             return in_array($field, $this->includedFields, true);
743 743
         } elseif (count($this->excludedFields) > 0) {
744
-            return ! in_array($field, $this->includedFields, true);
744
+            return !in_array($field, $this->includedFields, true);
745 745
         } else {
746 746
             return false;
747 747
         }
Please login to merge, or discard this patch.