@@ -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; |
@@ -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()) { |
@@ -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 = trim($request->requestVar('replace')); |
33 | - if (! is_string($replace)) { |
|
33 | + if (!is_string($replace)) { |
|
34 | 34 | $replace = ''; |
35 | 35 | } |
36 | 36 |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | public function setBypassCanMethods(bool $b): SearchApi |
162 | 162 | { |
163 | - if (! Director::is_cli()) { |
|
163 | + if (!Director::is_cli()) { |
|
164 | 164 | user_error('setBypassCanMethods() is only available in CLI mode. Use with caution as it will bypass all canView() and canEdit() checks.', E_USER_WARNING); |
165 | 165 | } else { |
166 | 166 | $this->bypassCanMethods = $b; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $className = $item->ClassName; |
291 | 291 | $fields = $this->getAllValidFields($className); |
292 | 292 | foreach ($fields as $field) { |
293 | - if (! $this->includeFieldTest($className, $field)) { |
|
293 | + if (!$this->includeFieldTest($className, $field)) { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | if ($type === 'url') { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $myStage = Versioned::get_stage(); |
346 | 346 | Versioned::set_stage(Versioned::DRAFT); |
347 | 347 | // is it on live and is live the same as draft |
348 | - $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft(); |
|
348 | + $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft(); |
|
349 | 349 | $item->writeToStage(Versioned::DRAFT); |
350 | 350 | if ($canBePublished) { |
351 | 351 | $item->publishSingle(); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | if (count($this->words) > 0) { |
380 | 380 | foreach ($this->getAllDataObjects() as $className) { |
381 | - if (! $this->includeClassTest($className)) { |
|
381 | + if (!$this->includeClassTest($className)) { |
|
382 | 382 | continue; |
383 | 383 | } |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $fields = $this->getAllValidFields($className); |
387 | 387 | $filterAny = []; |
388 | 388 | foreach ($fields as $field) { |
389 | - if (! $this->includeFieldTest($className, $field)) { |
|
389 | + if (!$this->includeFieldTest($className, $field)) { |
|
390 | 390 | continue; |
391 | 391 | } |
392 | 392 | $filterAny[$field . ':PartialMatch'] = $this->words; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $back = $this->config()->get('hours_back_for_recent') ?: 24; |
436 | 436 | $limit = $this->Config()->get('limit_per_class_for_recent') ?: 5; |
437 | 437 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
438 | - if (! $threshold) { |
|
438 | + if (!$threshold) { |
|
439 | 439 | $threshold = time() - 86400; |
440 | 440 | } |
441 | 441 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | $finder->saveCache(); |
543 | 543 | |
544 | - if (! empty($this->sortOverride)) { |
|
544 | + if (!empty($this->sortOverride)) { |
|
545 | 545 | return $list->sort($this->sortOverride); |
546 | 546 | } else { |
547 | 547 | return $list->sort(['SiteWideSearchSortValue' => 'ASC']); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $testWords = array_unique($testWords); |
572 | 572 | foreach ($testWords as $wordKey => $word) { |
573 | 573 | //match a exact field to full words / one word |
574 | - $fullWords = ! (bool) $wordKey; |
|
574 | + $fullWords = !(bool) $wordKey; |
|
575 | 575 | if (false === $done) { |
576 | 576 | $count = 0; |
577 | 577 | foreach ($fieldValues as $fieldValue) { |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | protected function includeClassTest(string $className): bool |
691 | 691 | { |
692 | - if (count($this->includedClassesWithSubClassess) && ! in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
692 | + if (count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
693 | 693 | if ($this->debug) { |
694 | 694 | DB::alteration_message(' ... Skipping as not included ' . $className); |
695 | 695 | } |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | } elseif (count($this->includedFields) > 0) { |
716 | 716 | return in_array($field, $this->includedFields, true); |
717 | 717 | } elseif (count($this->excludedFields) > 0) { |
718 | - return ! in_array($field, $this->includedFields, true); |
|
718 | + return !in_array($field, $this->includedFields, true); |
|
719 | 719 | } else { |
720 | 720 | return false; |
721 | 721 | } |