@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | (new CheckboxField('QuickSearch', 'Search Main Fields Only', $this->isQuickSearch)) |
| 55 | 55 | ->setDescription('This is faster but only searches a limited number of fields') |
| 56 | 56 | ); |
| 57 | - if (! $this->getRequest()->requestVar('Keywords')) { |
|
| 57 | + if (!$this->getRequest()->requestVar('Keywords')) { |
|
| 58 | 58 | $resultsTitle = 'Recently Edited'; |
| 59 | 59 | $this->listHTML = $this->renderWith(self::class . '_Results'); |
| 60 | 60 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | public function SearchResults(): ?ArrayList |
| 116 | 116 | { |
| 117 | - $this->isQuickSearch = ! empty($this->rawData['QuickSearch']); |
|
| 117 | + $this->isQuickSearch = !empty($this->rawData['QuickSearch']); |
|
| 118 | 118 | $this->keywords = trim($this->rawData['Keywords'] ?? ''); |
| 119 | 119 | |
| 120 | 120 | return Injector::inst()->get(SearchApi ::class) |
@@ -212,12 +212,12 @@ discard block |
||
| 212 | 212 | if (count($this->words)) { |
| 213 | 213 | foreach ($this->getAllDataObjects() as $className) { |
| 214 | 214 | // if ($this->debug) {DB::alteration_message(' ... Searching in ' . $className);} |
| 215 | - if (! in_array($className, $this->excludedClasses, true)) { |
|
| 215 | + if (!in_array($className, $this->excludedClasses, true)) { |
|
| 216 | 216 | $array[$className] = []; |
| 217 | 217 | $fields = $this->getAllValidFields($className); |
| 218 | 218 | $filterAny = []; |
| 219 | 219 | foreach ($fields as $field) { |
| 220 | - if (! in_array($field, $this->excludedFields, true)) { |
|
| 220 | + if (!in_array($field, $this->excludedFields, true)) { |
|
| 221 | 221 | // if ($this->debug) {DB::alteration_message(' ... ... Searching in ' . $className . '.' . $field);} |
| 222 | 222 | $filterAny[$field . ':PartialMatch'] = $this->words; |
| 223 | 223 | } |
@@ -250,14 +250,14 @@ discard block |
||
| 250 | 250 | $back = $this->config()->get('hours_back_for_recent') ?? 24; |
| 251 | 251 | $limit = $this->Config()->get('limit_per_class_for_recent') ?? 5; |
| 252 | 252 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
| 253 | - if (! $threshold) { |
|
| 253 | + if (!$threshold) { |
|
| 254 | 254 | $threshold = time() - 86400; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $array = []; |
| 258 | 258 | $classNames = $this->getAllDataObjects(); |
| 259 | 259 | foreach ($classNames as $className) { |
| 260 | - if (! in_array($className, $this->excludedClasses, true)) { |
|
| 260 | + if (!in_array($className, $this->excludedClasses, true)) { |
|
| 261 | 261 | $array[$className] = $className::get() |
| 262 | 262 | ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold)) |
| 263 | 263 | ->sort('LastEdited', 'DESC') |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $testWords = array_unique($testWords); |
| 343 | 343 | foreach ($testWords as $wordKey => $word) { |
| 344 | 344 | //match a exact field to full words / one word |
| 345 | - $fullWords = ! (bool) $wordKey; |
|
| 345 | + $fullWords = !(bool) $wordKey; |
|
| 346 | 346 | if (false === $done) { |
| 347 | 347 | $count = 0; |
| 348 | 348 | foreach ($fieldValues as $fieldValue) { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $this->words[] = $word; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - if (! count($this->words)) { |
|
| 417 | + if (!count($this->words)) { |
|
| 418 | 418 | user_error('No word has been provided'); |
| 419 | 419 | } |
| 420 | 420 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | protected function getAllDataObjects(): array |
| 429 | 429 | { |
| 430 | 430 | // if ($this->debug) {DB::alteration_message('Base Class: ' . $this->baseClass);} |
| 431 | - if (! isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 431 | + if (!isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 432 | 432 | $this->cache['AllDataObjects'][$this->baseClass] = array_values( |
| 433 | 433 | ClassInfo::subclassesFor($this->baseClass, false) |
| 434 | 434 | ); |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | protected function getAllValidFields(string $className): array |
| 442 | 442 | { |
| 443 | - if (! isset($this->cache['AllValidFields'][$className])) { |
|
| 443 | + if (!isset($this->cache['AllValidFields'][$className])) { |
|
| 444 | 444 | $array = []; |
| 445 | 445 | $fullList = Config::inst()->get($className, 'db'); |
| 446 | 446 | if (is_array($fullList)) { |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | protected function getIndexedFields(string $className, array $dbFields): array |
| 468 | 468 | { |
| 469 | - if (! isset($this->cache['IndexedFields'][$className])) { |
|
| 469 | + if (!isset($this->cache['IndexedFields'][$className])) { |
|
| 470 | 470 | $this->cache['IndexedFields'][$className] = []; |
| 471 | 471 | $indexes = Config::inst()->get($className, 'indexes'); |
| 472 | 472 | if (is_array($indexes)) { |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | protected function isValidFieldType(string $className, string $fieldName, string $type): bool |
| 503 | 503 | { |
| 504 | - if (! isset($this->cache['ValidFieldTypes'][$type])) { |
|
| 504 | + if (!isset($this->cache['ValidFieldTypes'][$type])) { |
|
| 505 | 505 | $this->cache['ValidFieldTypes'][$type] = false; |
| 506 | 506 | $singleton = Injector::inst()->get($className); |
| 507 | 507 | $field = $singleton->dbObject($fieldName); |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | return (string) $dataObject->{$validMethod}; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (! in_array($dataObject->ClassName, $this->excludedClasses, true)) { |
|
| 180 | + if (!in_array($dataObject->ClassName, $this->excludedClasses, true)) { |
|
| 181 | 181 | if (empty($this->cache[$type][$dataObject->ClassName]) || true !== $this->cache[$type][$dataObject->ClassName]) { |
| 182 | 182 | foreach ($validMethods as $validMethod) { |
| 183 | 183 | $outcome = null; |
| 184 | 184 | if ($dataObject->hasMethod($validMethod)) { |
| 185 | 185 | $outcome = $dataObject->{$validMethod}(); |
| 186 | - } elseif (! empty($dataObject->{$validMethod})) { |
|
| 186 | + } elseif (!empty($dataObject->{$validMethod})) { |
|
| 187 | 187 | $outcome = $dataObject->{$validMethod}; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | continue; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if (! isset($this->relationTypesCovered[$relType])) { |
|
| 218 | + if (!isset($this->relationTypesCovered[$relType])) { |
|
| 219 | 219 | $rels = $dataObject->{$relationName}(); |
| 220 | 220 | if ($rels) { |
| 221 | 221 | if ($rels instanceof DataList) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | protected function getRelations($dataObject): array |
| 244 | 244 | { |
| 245 | - if (! isset($this->cache['rels'][$dataObject->ClassName])) { |
|
| 245 | + if (!isset($this->cache['rels'][$dataObject->ClassName])) { |
|
| 246 | 246 | $this->cache['rels'][$dataObject->ClassName] = array_merge( |
| 247 | 247 | Config::inst()->get($dataObject->ClassName, 'belongs_to'), |
| 248 | 248 | Config::inst()->get($dataObject->ClassName, 'has_one'), |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | Config::inst()->get($dataObject->ClassName, 'many_many') |
| 252 | 252 | ); |
| 253 | 253 | foreach ($this->cache['rels'][$dataObject->ClassName] as $key => $value) { |
| 254 | - if (! in_array($value, $this->excludedClasses, true)) { |
|
| 254 | + if (!in_array($value, $this->excludedClasses, true)) { |
|
| 255 | 255 | unset($this->cache['rels'][$dataObject->ClassName][$key]); |
| 256 | 256 | } |
| 257 | 257 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | protected function getValidMethods(string $type): array |
| 264 | 264 | { |
| 265 | - if (! isset($this->cache['validMethods'][$type])) { |
|
| 265 | + if (!isset($this->cache['validMethods'][$type])) { |
|
| 266 | 266 | $this->cache['validMethods'][$type] = $this->Config()->get($type); |
| 267 | 267 | } |
| 268 | 268 | |