@@ -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 |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $className = $item->ClassName; |
278 | 278 | $fields = $this->getAllValidFields($className); |
279 | 279 | foreach ($fields as $field) { |
280 | - if (! $this->includeFieldTest($className, $field)) { |
|
280 | + if (!$this->includeFieldTest($className, $field)) { |
|
281 | 281 | continue; |
282 | 282 | } |
283 | 283 | if ($type === 'url') { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $myStage = Versioned::get_stage(); |
333 | 333 | Versioned::set_stage(Versioned::DRAFT); |
334 | 334 | // is it on live and is live the same as draft |
335 | - $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft(); |
|
335 | + $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft(); |
|
336 | 336 | $item->writeToStage(Versioned::DRAFT); |
337 | 337 | if ($canBePublished) { |
338 | 338 | $item->publishSingle(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | if (count($this->words) > 0) { |
367 | 367 | foreach ($this->getAllDataObjects() as $className) { |
368 | - if (! $this->includeClassTest($className)) { |
|
368 | + if (!$this->includeClassTest($className)) { |
|
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $fields = $this->getAllValidFields($className); |
374 | 374 | $filterAny = []; |
375 | 375 | foreach ($fields as $field) { |
376 | - if (! $this->includeFieldTest($className, $field)) { |
|
376 | + if (!$this->includeFieldTest($className, $field)) { |
|
377 | 377 | continue; |
378 | 378 | } |
379 | 379 | $filterAny[$field . ':PartialMatch'] = $this->words; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $back = $this->config()->get('hours_back_for_recent') ?: 24; |
423 | 423 | $limit = $this->Config()->get('limit_per_class_for_recent') ?: 5; |
424 | 424 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
425 | - if (! $threshold) { |
|
425 | + if (!$threshold) { |
|
426 | 426 | $threshold = time() - 86400; |
427 | 427 | } |
428 | 428 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } |
529 | 529 | $finder->saveCache(); |
530 | 530 | |
531 | - if (! empty($this->sortOverride)) { |
|
531 | + if (!empty($this->sortOverride)) { |
|
532 | 532 | return $list->sort($this->sortOverride); |
533 | 533 | } else { |
534 | 534 | return $list->sort(['SiteWideSearchSortValue' => 'ASC']); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | $testWords = array_unique($testWords); |
559 | 559 | foreach ($testWords as $wordKey => $word) { |
560 | 560 | //match a exact field to full words / one word |
561 | - $fullWords = ! (bool) $wordKey; |
|
561 | + $fullWords = !(bool) $wordKey; |
|
562 | 562 | if (false === $done) { |
563 | 563 | $count = 0; |
564 | 564 | foreach ($fieldValues as $fieldValue) { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | protected function includeClassTest(string $className): bool |
678 | 678 | { |
679 | - if (count($this->includedClassesWithSubClassess) && ! in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
679 | + if (count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
680 | 680 | if ($this->debug) { |
681 | 681 | DB::alteration_message(' ... Skipping as not included ' . $className); |
682 | 682 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | } elseif (count($this->includedFields) > 0) { |
703 | 703 | return in_array($field, $this->includedFields, true); |
704 | 704 | } elseif (count($this->excludedFields) > 0) { |
705 | - return ! in_array($field, $this->includedFields, true); |
|
705 | + return !in_array($field, $this->includedFields, true); |
|
706 | 706 | } else { |
707 | 707 | return false; |
708 | 708 | } |