@@ -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 |
@@ -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 | } |