Passed
Push — master ( d4c39a...eb00de )
by Nicolaas
03:16
created
src/Api/SearchApi.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         if ($item->hasExtension(Versioned::class)) {
264 264
             ReadingMode::validateStage(Versioned::DRAFT);
265 265
             // is it on live and is live the same as draft
266
-            $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft();
266
+            $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft();
267 267
             $item->writeToStage(Versioned::DRAFT);
268 268
             if ($canBePublished) {
269 269
                 $item->publishSingle();
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
                     DB::alteration_message(' ... Searching in ' . $className);
296 296
                 }
297 297
 
298
-                if (! in_array($className, $this->excludedClasses, true)) {
298
+                if (!in_array($className, $this->excludedClasses, true)) {
299 299
                     $array[$className] = [];
300 300
                     $fields = $this->getAllValidFields($className);
301 301
                     $filterAny = [];
302 302
                     foreach ($fields as $field) {
303
-                        if (! in_array($field, $this->excludedFields, true)) {
303
+                        if (!in_array($field, $this->excludedFields, true)) {
304 304
                             if ($this->debug) {
305 305
                                 DB::alteration_message(' ... ... Searching in ' . $className . '.' . $field);
306 306
                             }
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
         $back = $this->config()->get('hours_back_for_recent') ?? 24;
353 353
         $limit = $this->Config()->get('limit_per_class_for_recent') ?? 5;
354 354
         $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp());
355
-        if (! $threshold) {
355
+        if (!$threshold) {
356 356
             $threshold = time() - 86400;
357 357
         }
358 358
 
359 359
         $array = [];
360 360
         $classNames = $this->getAllDataObjects();
361 361
         foreach ($classNames as $className) {
362
-            if (! in_array($className, $this->excludedClasses, true)) {
362
+            if (!in_array($className, $this->excludedClasses, true)) {
363 363
                 $array[$className] = $className::get()
364 364
                     ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold))
365 365
                     ->sort('LastEdited', 'DESC')
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
             $testWords = array_unique($testWords);
469 469
             foreach ($testWords as $wordKey => $word) {
470 470
                 //match a exact field to full words / one word
471
-                $fullWords = ! (bool) $wordKey;
471
+                $fullWords = !(bool) $wordKey;
472 472
                 if (false === $done) {
473 473
                     $count = 0;
474 474
                     foreach ($fieldValues as $fieldValue) {
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             $this->words[] = $word;
545 545
         }
546 546
 
547
-        if (! count($this->words)) {
547
+        if (!count($this->words)) {
548 548
             user_error('No word has been provided');
549 549
         }
550 550
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
             DB::alteration_message('Base Class: ' . $this->baseClass);
562 562
         }
563 563
 
564
-        if (! isset($this->cache['AllDataObjects'][$this->baseClass])) {
564
+        if (!isset($this->cache['AllDataObjects'][$this->baseClass])) {
565 565
             $this->cache['AllDataObjects'][$this->baseClass] = array_values(
566 566
                 ClassInfo::subclassesFor($this->baseClass, false)
567 567
             );
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 
574 574
     protected function getAllValidFields(string $className): array
575 575
     {
576
-        if (! isset($this->cache['AllValidFields'][$className])) {
576
+        if (!isset($this->cache['AllValidFields'][$className])) {
577 577
             $array = [];
578 578
             $fullList = Config::inst()->get($className, 'db');
579 579
             if (is_array($fullList)) {
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
     protected function getIndexedFields(string $className, array $dbFields): array
601 601
     {
602
-        if (! isset($this->cache['IndexedFields'][$className])) {
602
+        if (!isset($this->cache['IndexedFields'][$className])) {
603 603
             $this->cache['IndexedFields'][$className] = [];
604 604
             $indexes = Config::inst()->get($className, 'indexes');
605 605
             if (is_array($indexes)) {
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
     protected function isValidFieldType(string $className, string $fieldName, string $type): bool
636 636
     {
637
-        if (! isset($this->cache['ValidFieldTypes'][$type])) {
637
+        if (!isset($this->cache['ValidFieldTypes'][$type])) {
638 638
             $this->cache['ValidFieldTypes'][$type] = false;
639 639
             $singleton = Injector::inst()->get($className);
640 640
             $field = $singleton->dbObject($fieldName);
Please login to merge, or discard this patch.