@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $outcome = null; |
| 214 | 214 | if ($dataObject->hasMethod($validMethod)) { |
| 215 | 215 | $outcome = $dataObject->{$validMethod}(); |
| 216 | - } elseif (! empty($dataObject->{$validMethod})) { |
|
| 216 | + } elseif (!empty($dataObject->{$validMethod})) { |
|
| 217 | 217 | $outcome = $dataObject->{$validMethod}; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | continue; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if (! isset($this->relationTypesCovered[$relType])) { |
|
| 246 | + if (!isset($this->relationTypesCovered[$relType])) { |
|
| 247 | 247 | $rels = null; |
| 248 | 248 | if ($dataObject->hasMethod($relationName)) { |
| 249 | 249 | $rels = $dataObject->{$relationName}(); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | user_error('Relation ' . print_r($relationName, 1) . ' does not exist on ' . $dataObject->ClassName . ' Relations are: ' . print_r($this->getRelations($dataObject), 1), E_USER_NOTICE); |
| 252 | 252 | } |
| 253 | 253 | if ($rels) { |
| 254 | - if ($rels instanceof DataList && ! $rels instanceof UnsavedRelationList) { |
|
| 254 | + if ($rels instanceof DataList && !$rels instanceof UnsavedRelationList) { |
|
| 255 | 255 | $rels = $rels->first(); |
| 256 | 256 | } |
| 257 | 257 | if ($rels && $rels instanceof DataObject && $rels->exists()) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | protected function getRelations($dataObject): array |
| 272 | 272 | { |
| 273 | - if (! isset($this->cache['rels'][$dataObject->ClassName])) { |
|
| 273 | + if (!isset($this->cache['rels'][$dataObject->ClassName])) { |
|
| 274 | 274 | $this->cache['rels'][$dataObject->ClassName] = array_merge( |
| 275 | 275 | Config::inst()->get($dataObject->ClassName, 'belongs_to'), |
| 276 | 276 | Config::inst()->get($dataObject->ClassName, 'has_one'), |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | Config::inst()->get($dataObject->ClassName, 'many_many') |
| 280 | 280 | ); |
| 281 | 281 | foreach ($this->cache['rels'][$dataObject->ClassName] as $key => $value) { |
| 282 | - if (! (is_string($value) && class_exists($value) && $this->classCanBeIncluded($value))) { |
|
| 282 | + if (!(is_string($value) && class_exists($value) && $this->classCanBeIncluded($value))) { |
|
| 283 | 283 | unset($this->cache['rels'][$dataObject->ClassName][$key]); |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | protected function getValidMethods(string $type): array |
| 292 | 292 | { |
| 293 | - if (! isset($this->cache['validMethods'][$type])) { |
|
| 293 | + if (!isset($this->cache['validMethods'][$type])) { |
|
| 294 | 294 | $this->cache['validMethods'][$type] = $this->Config()->get($type); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | protected function classCanBeIncluded(string $dataObjectClassName): bool |
| 304 | 304 | { |
| 305 | 305 | if (count($this->excludedClasses) > 0) { |
| 306 | - if (! class_exists($dataObjectClassName)) { |
|
| 306 | + if (!class_exists($dataObjectClassName)) { |
|
| 307 | 307 | return false; |
| 308 | 308 | } |
| 309 | - return ! in_array($dataObjectClassName, $this->excludedClasses, true); |
|
| 309 | + return !in_array($dataObjectClassName, $this->excludedClasses, true); |
|
| 310 | 310 | } |
| 311 | 311 | user_error('Please set excludedClasses', E_USER_NOTICE); |
| 312 | 312 | return false; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | )->setHeadingLevel(4) |
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | - if (! $this->getRequest()->requestVar('Keywords')) { |
|
| 106 | + if (!$this->getRequest()->requestVar('Keywords')) { |
|
| 107 | 107 | $lastResults = $this->lastSearchResults(); |
| 108 | 108 | $resultsTitle = $lastResults instanceof \SilverStripe\ORM\ArrayList ? 'Last Results' : 'Last Edited'; |
| 109 | 109 | $this->listHTML = $this->renderWith(self::class . '_Results'); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if ($results->count() === 1) { |
| 202 | 202 | $result = $results->first(); |
| 203 | 203 | // files do not re-redirect nicely... |
| 204 | - if ($result->HasCMSEditLink && $result->CMSEditLink && ! in_array(File::class, ClassInfo::ancestry($result->ClassName), true)) { |
|
| 204 | + if ($result->HasCMSEditLink && $result->CMSEditLink && !in_array(File::class, ClassInfo::ancestry($result->ClassName), true)) { |
|
| 205 | 205 | // this is a variable, not a method! |
| 206 | 206 | $this->redirect($result->CMSEditLink); |
| 207 | 207 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | protected function workOutBoolean(string $fieldName, ?array $data = null, ?bool $default = false): bool |
| 218 | 218 | { |
| 219 | - return (bool) (isset($data['IsSubmitHiddenField']) ? ! empty($data[$fieldName]) : $default); |
|
| 219 | + return (bool) (isset($data['IsSubmitHiddenField']) ? !empty($data[$fieldName]) : $default); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | protected function workOutString(string $fieldName, ?array $data = null, ?string $default = ''): string |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $session->set('QuickSearchType', ''); |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | - if (! $this->quickSearchType) { |
|
| 251 | + if (!$this->quickSearchType) { |
|
| 252 | 252 | $this->quickSearchType = $this->Config()->get('default_quick_search_type'); |
| 253 | 253 | } |
| 254 | 254 | return (string) $this->quickSearchType; |
@@ -25,12 +25,12 @@ |
||
| 25 | 25 | Environment::increaseMemoryLimitTo(-1); |
| 26 | 26 | $debug = $request->postVar('debug') ? 'checked="checked"' : ''; |
| 27 | 27 | $word = $request->requestVar('word'); |
| 28 | - if (! is_string($word)) { |
|
| 28 | + if (!is_string($word)) { |
|
| 29 | 29 | $word = ''; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $replace = $request->requestVar('replace'); |
| 33 | - if (! is_string($replace)) { |
|
| 33 | + if (!is_string($replace)) { |
|
| 34 | 34 | $replace = ''; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | if ($item->canEdit()) { |
| 258 | 258 | $fields = $this->getAllValidFields($className); |
| 259 | 259 | foreach ($fields as $field) { |
| 260 | - if (! $this->includeFieldTest($className, $field)) { |
|
| 260 | + if (!$this->includeFieldTest($className, $field)) { |
|
| 261 | 261 | continue; |
| 262 | 262 | } |
| 263 | 263 | $new = str_replace($word, $replace, $item->{$field}); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $myStage = Versioned::get_stage(); |
| 299 | 299 | Versioned::set_stage(Versioned::DRAFT); |
| 300 | 300 | // is it on live and is live the same as draft |
| 301 | - $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft(); |
|
| 301 | + $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft(); |
|
| 302 | 302 | $item->writeToStage(Versioned::DRAFT); |
| 303 | 303 | if ($canBePublished) { |
| 304 | 304 | $item->publishSingle(); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | if (count($this->words) > 0) { |
| 333 | 333 | foreach ($this->getAllDataObjects() as $className) { |
| 334 | - if (! $this->includeClassTest($className)) { |
|
| 334 | + if (!$this->includeClassTest($className)) { |
|
| 335 | 335 | continue; |
| 336 | 336 | } |
| 337 | 337 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $fields = $this->getAllValidFields($className); |
| 340 | 340 | $filterAny = []; |
| 341 | 341 | foreach ($fields as $field) { |
| 342 | - if (! $this->includeFieldTest($className, $field)) { |
|
| 342 | + if (!$this->includeFieldTest($className, $field)) { |
|
| 343 | 343 | continue; |
| 344 | 344 | } |
| 345 | 345 | $filterAny[$field . ':PartialMatch'] = $this->words; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $back = $this->config()->get('hours_back_for_recent') ?: 24; |
| 390 | 390 | $limit = $this->Config()->get('limit_per_class_for_recent') ?: 5; |
| 391 | 391 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
| 392 | - if (! $threshold) { |
|
| 392 | + if (!$threshold) { |
|
| 393 | 393 | $threshold = time() - 86400; |
| 394 | 394 | } |
| 395 | 395 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | $finder->saveCache(); |
| 499 | 499 | |
| 500 | - if (! empty($this->sortOverride)) { |
|
| 500 | + if (!empty($this->sortOverride)) { |
|
| 501 | 501 | return $list->sort($this->sortOverride); |
| 502 | 502 | } else { |
| 503 | 503 | return $list->sort(['SiteWideSearchSortValue' => 'ASC']); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | $testWords = array_unique($testWords); |
| 528 | 528 | foreach ($testWords as $wordKey => $word) { |
| 529 | 529 | //match a exact field to full words / one word |
| 530 | - $fullWords = ! (bool) $wordKey; |
|
| 530 | + $fullWords = !(bool) $wordKey; |
|
| 531 | 531 | if (false === $done) { |
| 532 | 532 | $count = 0; |
| 533 | 533 | foreach ($fieldValues as $fieldValue) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | |
| 646 | 646 | protected function includeClassTest(string $className): bool |
| 647 | 647 | { |
| 648 | - if (count($this->includedClassesWithSubClassess) && ! in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
| 648 | + if (count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
| 649 | 649 | if ($this->debug) { |
| 650 | 650 | DB::alteration_message(' ... Skipping as not included ' . $className); |
| 651 | 651 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } elseif (count($this->includedFields) > 0) { |
| 672 | 672 | return in_array($field, $this->includedFields, true); |
| 673 | 673 | } elseif (count($this->excludedFields) > 0) { |
| 674 | - return ! in_array($field, $this->includedFields, true); |
|
| 674 | + return !in_array($field, $this->includedFields, true); |
|
| 675 | 675 | } else { |
| 676 | 676 | return false; |
| 677 | 677 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function getAllDataObjects(): array |
| 103 | 103 | { |
| 104 | - if (! isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 104 | + if (!isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 105 | 105 | $this->cache['AllDataObjects'][$this->baseClass] = array_values( |
| 106 | 106 | ClassInfo::subclassesFor($this->baseClass, false) |
| 107 | 107 | ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function getAllValidFields(string $className, ?bool $isQuickSearch = false, ?array $includedFields = [], ?array $includedClassFieldCombos = []): array |
| 115 | 115 | { |
| 116 | - if (! isset($this->cache['AllValidFields'][$className])) { |
|
| 116 | + if (!isset($this->cache['AllValidFields'][$className])) { |
|
| 117 | 117 | $this->cache['AllValidFields'][$className] = Config::inst()->get($className, 'db') ?? []; |
| 118 | 118 | $this->cache['AllValidFields'][$className] = array_merge( |
| 119 | 119 | $this->cache['AllValidFields'][$className], |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | protected function getAllIndexedFields(string $className, array $dbFields): array |
| 150 | 150 | { |
| 151 | - if (! isset($this->cache['AllIndexedFields'][$className])) { |
|
| 151 | + if (!isset($this->cache['AllIndexedFields'][$className])) { |
|
| 152 | 152 | $this->cache['AllIndexedFields'][$className] = []; |
| 153 | 153 | $indexes = Config::inst()->get($className, 'indexes'); |
| 154 | 154 | if (is_array($indexes)) { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | - } elseif(isset($dbFields[$key])) { |
|
| 174 | + } elseif (isset($dbFields[$key])) { |
|
| 175 | 175 | $this->cache['AllIndexedFields'][$className][$key] = $key; |
| 176 | 176 | } |
| 177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | protected function isValidFieldType(string $type, string $className, string $fieldName): bool |
| 188 | 188 | { |
| 189 | - if (! isset($this->cache['AllValidFieldTypes'][$type])) { |
|
| 189 | + if (!isset($this->cache['AllValidFieldTypes'][$type])) { |
|
| 190 | 190 | $this->cache['AllValidFieldTypes'][$type] = false; |
| 191 | 191 | $singleton = Injector::inst()->get($className); |
| 192 | 192 | $field = $singleton->dbObject($fieldName); |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | 'limited' => 'Quick search (limited search)', |
| 71 | 71 | ]; |
| 72 | 72 | $availableSearchClasses = self::available_quick_searches(); |
| 73 | - if (! empty($availableSearchClasses) > 0) { |
|
| 73 | + if (!empty($availableSearchClasses) > 0) { |
|
| 74 | 74 | foreach ($availableSearchClasses as $availableSearchClass) { |
| 75 | 75 | $singleton = Injector::inst()->get($availableSearchClass); |
| 76 | 76 | if ($singleton->isEnabled()) { |