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