@@ -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 | |
@@ -40,12 +40,12 @@ |
||
| 40 | 40 | Environment::increaseMemoryLimitTo(-1); |
| 41 | 41 | $debug = $request->postVar('debug') ? 'checked="checked"' : ''; |
| 42 | 42 | $word = Convert::raw2sql($request->requestVar('word')); |
| 43 | - if (! is_string($word)) { |
|
| 43 | + if (!is_string($word)) { |
|
| 44 | 44 | $word = ''; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $replace = Convert::raw2sql($request->requestVar('replace')); |
| 48 | - if (! is_string($replace)) { |
|
| 48 | + if (!is_string($replace)) { |
|
| 49 | 49 | $replace = ''; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | (new CheckboxField('SearchWholePhrase', 'Search exact phrase', $this->searchWholePhrase)) |
| 75 | 75 | ->setDescription('If ticked, any item will be included that includes the whole phrase (e.g. New Zealand, rather than New OR Zealand)') |
| 76 | 76 | ); |
| 77 | - if (! $this->getRequest()->requestVar('Keywords')) { |
|
| 77 | + if (!$this->getRequest()->requestVar('Keywords')) { |
|
| 78 | 78 | $resultsTitle = 'Recently Edited'; |
| 79 | 79 | $this->listHTML = $this->renderWith(self::class . '_Results'); |
| 80 | 80 | } else { |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | Environment::increaseTimeLimitTo(300); |
| 138 | 138 | Environment::setMemoryLimitMax(-1); |
| 139 | 139 | Environment::increaseMemoryLimitTo(-1); |
| 140 | - $this->isQuickSearch = ! empty($this->rawData['QuickSearch']); |
|
| 141 | - $this->searchWholePhrase = ! empty($this->rawData['SearchWholePhrase']); |
|
| 142 | - $this->applyReplace = ! empty($this->rawData['ApplyReplace']); |
|
| 140 | + $this->isQuickSearch = !empty($this->rawData['QuickSearch']); |
|
| 141 | + $this->searchWholePhrase = !empty($this->rawData['SearchWholePhrase']); |
|
| 142 | + $this->applyReplace = !empty($this->rawData['ApplyReplace']); |
|
| 143 | 143 | $this->keywords = trim($this->rawData['Keywords'] ?? ''); |
| 144 | 144 | $this->replace = trim($this->rawData['ReplaceWith'] ?? ''); |
| 145 | 145 | if ($this->applyReplace) { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $myStage = Versioned::get_stage(); |
| 265 | 265 | Versioned::set_stage(Versioned::DRAFT); |
| 266 | 266 | // is it on live and is live the same as draft |
| 267 | - $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft(); |
|
| 267 | + $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft(); |
|
| 268 | 268 | $item->writeToStage(Versioned::DRAFT); |
| 269 | 269 | if ($canBePublished) { |
| 270 | 270 | $item->publishSingle(); |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | DB::alteration_message(' ... Searching in ' . $className); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if (! in_array($className, $this->excludedClasses, true)) { |
|
| 300 | + if (!in_array($className, $this->excludedClasses, true)) { |
|
| 301 | 301 | $array[$className] = []; |
| 302 | 302 | $fields = $this->getAllValidFields($className); |
| 303 | 303 | $filterAny = []; |
| 304 | 304 | foreach ($fields as $field) { |
| 305 | - if (! in_array($field, $this->excludedFields, true)) { |
|
| 305 | + if (!in_array($field, $this->excludedFields, true)) { |
|
| 306 | 306 | if ($this->debug) { |
| 307 | 307 | DB::alteration_message(' ... ... Searching in ' . $className . '.' . $field); |
| 308 | 308 | } |
@@ -354,14 +354,14 @@ discard block |
||
| 354 | 354 | $back = $this->config()->get('hours_back_for_recent') ?? 24; |
| 355 | 355 | $limit = $this->Config()->get('limit_per_class_for_recent') ?? 5; |
| 356 | 356 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
| 357 | - if (! $threshold) { |
|
| 357 | + if (!$threshold) { |
|
| 358 | 358 | $threshold = time() - 86400; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $array = []; |
| 362 | 362 | $classNames = $this->getAllDataObjects(); |
| 363 | 363 | foreach ($classNames as $className) { |
| 364 | - if (! in_array($className, $this->excludedClasses, true)) { |
|
| 364 | + if (!in_array($className, $this->excludedClasses, true)) { |
|
| 365 | 365 | $array[$className] = $className::get() |
| 366 | 366 | ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold)) |
| 367 | 367 | ->sort('LastEdited', 'DESC') |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | $testWords = array_unique($testWords); |
| 471 | 471 | foreach ($testWords as $wordKey => $word) { |
| 472 | 472 | //match a exact field to full words / one word |
| 473 | - $fullWords = ! (bool) $wordKey; |
|
| 473 | + $fullWords = !(bool) $wordKey; |
|
| 474 | 474 | if (false === $done) { |
| 475 | 475 | $count = 0; |
| 476 | 476 | foreach ($fieldValues as $fieldValue) { |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $this->words[] = $word; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - if (! count($this->words)) { |
|
| 549 | + if (!count($this->words)) { |
|
| 550 | 550 | user_error('No word has been provided'); |
| 551 | 551 | } |
| 552 | 552 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | DB::alteration_message('Base Class: ' . $this->baseClass); |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - if (! isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 566 | + if (!isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 567 | 567 | $this->cache['AllDataObjects'][$this->baseClass] = array_values( |
| 568 | 568 | ClassInfo::subclassesFor($this->baseClass, false) |
| 569 | 569 | ); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | protected function getAllValidFields(string $className): array |
| 577 | 577 | { |
| 578 | - if (! isset($this->cache['AllValidFields'][$className])) { |
|
| 578 | + if (!isset($this->cache['AllValidFields'][$className])) { |
|
| 579 | 579 | $array = []; |
| 580 | 580 | $fullList = Config::inst()->get($className, 'db'); |
| 581 | 581 | if (is_array($fullList)) { |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | protected function getIndexedFields(string $className, array $dbFields): array |
| 603 | 603 | { |
| 604 | - if (! isset($this->cache['IndexedFields'][$className])) { |
|
| 604 | + if (!isset($this->cache['IndexedFields'][$className])) { |
|
| 605 | 605 | $this->cache['IndexedFields'][$className] = []; |
| 606 | 606 | $indexes = Config::inst()->get($className, 'indexes'); |
| 607 | 607 | if (is_array($indexes)) { |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | |
| 637 | 637 | protected function isValidFieldType(string $className, string $fieldName, string $type): bool |
| 638 | 638 | { |
| 639 | - if (! isset($this->cache['ValidFieldTypes'][$type])) { |
|
| 639 | + if (!isset($this->cache['ValidFieldTypes'][$type])) { |
|
| 640 | 640 | $this->cache['ValidFieldTypes'][$type] = false; |
| 641 | 641 | $singleton = Injector::inst()->get($className); |
| 642 | 642 | $field = $singleton->dbObject($fieldName); |