@@ -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) { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | if ($item->hasExtension(Versioned::class)) { |
| 264 | 264 | ReadingMode::validateStage(Versioned::DRAFT); |
| 265 | 265 | // is it on live and is live the same as draft |
| 266 | - $canBePublished = $item->isPublished() && ! $item->isModifiedOnDraft(); |
|
| 266 | + $canBePublished = $item->isPublished() && !$item->isModifiedOnDraft(); |
|
| 267 | 267 | $item->writeToStage(Versioned::DRAFT); |
| 268 | 268 | if ($canBePublished) { |
| 269 | 269 | $item->publishSingle(); |
@@ -295,12 +295,12 @@ discard block |
||
| 295 | 295 | DB::alteration_message(' ... Searching in ' . $className); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - if (! in_array($className, $this->excludedClasses, true)) { |
|
| 298 | + if (!in_array($className, $this->excludedClasses, true)) { |
|
| 299 | 299 | $array[$className] = []; |
| 300 | 300 | $fields = $this->getAllValidFields($className); |
| 301 | 301 | $filterAny = []; |
| 302 | 302 | foreach ($fields as $field) { |
| 303 | - if (! in_array($field, $this->excludedFields, true)) { |
|
| 303 | + if (!in_array($field, $this->excludedFields, true)) { |
|
| 304 | 304 | if ($this->debug) { |
| 305 | 305 | DB::alteration_message(' ... ... Searching in ' . $className . '.' . $field); |
| 306 | 306 | } |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | $back = $this->config()->get('hours_back_for_recent') ?? 24; |
| 353 | 353 | $limit = $this->Config()->get('limit_per_class_for_recent') ?? 5; |
| 354 | 354 | $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp()); |
| 355 | - if (! $threshold) { |
|
| 355 | + if (!$threshold) { |
|
| 356 | 356 | $threshold = time() - 86400; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | $array = []; |
| 360 | 360 | $classNames = $this->getAllDataObjects(); |
| 361 | 361 | foreach ($classNames as $className) { |
| 362 | - if (! in_array($className, $this->excludedClasses, true)) { |
|
| 362 | + if (!in_array($className, $this->excludedClasses, true)) { |
|
| 363 | 363 | $array[$className] = $className::get() |
| 364 | 364 | ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold)) |
| 365 | 365 | ->sort('LastEdited', 'DESC') |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $testWords = array_unique($testWords); |
| 469 | 469 | foreach ($testWords as $wordKey => $word) { |
| 470 | 470 | //match a exact field to full words / one word |
| 471 | - $fullWords = ! (bool) $wordKey; |
|
| 471 | + $fullWords = !(bool) $wordKey; |
|
| 472 | 472 | if (false === $done) { |
| 473 | 473 | $count = 0; |
| 474 | 474 | foreach ($fieldValues as $fieldValue) { |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $this->words[] = $word; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - if (! count($this->words)) { |
|
| 547 | + if (!count($this->words)) { |
|
| 548 | 548 | user_error('No word has been provided'); |
| 549 | 549 | } |
| 550 | 550 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | DB::alteration_message('Base Class: ' . $this->baseClass); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - if (! isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 564 | + if (!isset($this->cache['AllDataObjects'][$this->baseClass])) { |
|
| 565 | 565 | $this->cache['AllDataObjects'][$this->baseClass] = array_values( |
| 566 | 566 | ClassInfo::subclassesFor($this->baseClass, false) |
| 567 | 567 | ); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | protected function getAllValidFields(string $className): array |
| 575 | 575 | { |
| 576 | - if (! isset($this->cache['AllValidFields'][$className])) { |
|
| 576 | + if (!isset($this->cache['AllValidFields'][$className])) { |
|
| 577 | 577 | $array = []; |
| 578 | 578 | $fullList = Config::inst()->get($className, 'db'); |
| 579 | 579 | if (is_array($fullList)) { |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | protected function getIndexedFields(string $className, array $dbFields): array |
| 601 | 601 | { |
| 602 | - if (! isset($this->cache['IndexedFields'][$className])) { |
|
| 602 | + if (!isset($this->cache['IndexedFields'][$className])) { |
|
| 603 | 603 | $this->cache['IndexedFields'][$className] = []; |
| 604 | 604 | $indexes = Config::inst()->get($className, 'indexes'); |
| 605 | 605 | if (is_array($indexes)) { |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | protected function isValidFieldType(string $className, string $fieldName, string $type): bool |
| 636 | 636 | { |
| 637 | - if (! isset($this->cache['ValidFieldTypes'][$type])) { |
|
| 637 | + if (!isset($this->cache['ValidFieldTypes'][$type])) { |
|
| 638 | 638 | $this->cache['ValidFieldTypes'][$type] = false; |
| 639 | 639 | $singleton = Injector::inst()->get($className); |
| 640 | 640 | $field = $singleton->dbObject($fieldName); |