@@ -170,7 +170,7 @@ discard block |
||
| 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; |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | $className = $item->ClassName; |
| 301 | 301 | $fields = $this->getAllValidFields($className); |
| 302 | 302 | foreach ($fields as $field) { |
| 303 | - if (! $item->{$field} || ! is_string($item->{$field})) { |
|
| 303 | + if (!$item->{$field} || !is_string($item->{$field})) { |
|
| 304 | 304 | continue; |
| 305 | 305 | } |
| 306 | 306 | if (strpos($item->{$field}, $word) === false) { |
| 307 | 307 | continue; |
| 308 | 308 | } |
| 309 | - if (! $this->includeFieldTest($className, $field)) { |
|
| 309 | + if (!$this->includeFieldTest($className, $field)) { |
|
| 310 | 310 | continue; |
| 311 | 311 | } |
| 312 | 312 | if ($type === 'url') { |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $myStage = Versioned::get_stage(); |
| 365 | 365 | Versioned::set_stage(Versioned::DRAFT); |
| 366 | 366 | // is it on live and is live the same as draft |
| 367 | - $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft(); |
|
| 367 | + $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft(); |
|
| 368 | 368 | $item->writeToStage(Versioned::DRAFT); |
| 369 | 369 | if ($canBePublished) { |
| 370 | 370 | $item->publishSingle(); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | if (count($this->words) > 0) { |
| 399 | 399 | foreach ($this->getAllDataObjects() as $className) { |
| 400 | - if (! $this->includeClassTest($className)) { |
|
| 400 | + if (!$this->includeClassTest($className)) { |
|
| 401 | 401 | continue; |
| 402 | 402 | } |
| 403 | 403 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $fields = $this->getAllValidFields($className); |
| 406 | 406 | $filterAny = []; |
| 407 | 407 | foreach ($fields as $field) { |
| 408 | - if (! $this->includeFieldTest($className, $field)) { |
|
| 408 | + if (!$this->includeFieldTest($className, $field)) { |
|
| 409 | 409 | continue; |
| 410 | 410 | } |
| 411 | 411 | $filterAny[$field . ':PartialMatch'] = $this->words; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $back = $this->config()->get('hours_back_for_recent') ?: 24; |
| 455 | 455 | $limit = $this->Config()->get('limit_per_class_for_recent') ?: 5; |
| 456 | 456 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
| 457 | - if (! $threshold) { |
|
| 457 | + if (!$threshold) { |
|
| 458 | 458 | $threshold = time() - 86400; |
| 459 | 459 | } |
| 460 | 460 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | $finder->saveCache(); |
| 562 | 562 | |
| 563 | - if (! empty($this->sortOverride)) { |
|
| 563 | + if (!empty($this->sortOverride)) { |
|
| 564 | 564 | return $list->sort($this->sortOverride); |
| 565 | 565 | } else { |
| 566 | 566 | return $list->sort(['SiteWideSearchSortValue' => 'ASC']); |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | $testWords = array_unique($testWords); |
| 591 | 591 | foreach ($testWords as $wordKey => $word) { |
| 592 | 592 | //match a exact field to full words / one word |
| 593 | - $fullWords = ! (bool) $wordKey; |
|
| 593 | + $fullWords = !(bool) $wordKey; |
|
| 594 | 594 | if (false === $done) { |
| 595 | 595 | $count = 0; |
| 596 | 596 | foreach ($fieldValues as $fieldValue) { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | protected function includeClassTest(string $className): bool |
| 710 | 710 | { |
| 711 | - if (count($this->includedClassesWithSubClassess) && ! in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
| 711 | + if (count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
| 712 | 712 | if ($this->debug) { |
| 713 | 713 | DB::alteration_message(' ... Skipping as not included ' . $className); |
| 714 | 714 | } |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | } elseif (count($this->includedFields) > 0) { |
| 735 | 735 | return in_array($field, $this->includedFields, true); |
| 736 | 736 | } elseif (count($this->excludedFields) > 0) { |
| 737 | - return ! in_array($field, $this->includedFields, true); |
|
| 737 | + return !in_array($field, $this->includedFields, true); |
|
| 738 | 738 | } else { |
| 739 | 739 | return false; |
| 740 | 740 | } |