Passed
Push — master ( bb1745...de2527 )
by Nicolaas
10:14
created
src/Helpers/FindEditableObjects.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Api/SearchApi.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
                     DB::alteration_message(' ... Searching in ' . $className);
268 268
                 }
269 269
 
270
-                if (! in_array($className, $this->excludedClasses, true)) {
270
+                if (!in_array($className, $this->excludedClasses, true)) {
271 271
                     $array[$className] = [];
272 272
                     $fields = $this->getAllValidFields($className);
273 273
                     $filterAny = [];
274 274
                     foreach ($fields as $field) {
275
-                        if (! in_array($field, $this->excludedFields, true)) {
275
+                        if (!in_array($field, $this->excludedFields, true)) {
276 276
                             if ($this->debug) {
277 277
                                 DB::alteration_message(' ... ... Searching in ' . $className . '.' . $field);
278 278
                             }
@@ -324,14 +324,14 @@  discard block
 block discarded – undo
324 324
         $back = $this->config()->get('hours_back_for_recent') ?? 24;
325 325
         $limit = $this->Config()->get('limit_per_class_for_recent') ?? 5;
326 326
         $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp());
327
-        if (! $threshold) {
327
+        if (!$threshold) {
328 328
             $threshold = time() - 86400;
329 329
         }
330 330
 
331 331
         $array = [];
332 332
         $classNames = $this->getAllDataObjects();
333 333
         foreach ($classNames as $className) {
334
-            if (! in_array($className, $this->excludedClasses, true)) {
334
+            if (!in_array($className, $this->excludedClasses, true)) {
335 335
                 $array[$className] = $className::get()
336 336
                     ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold))
337 337
                     ->sort('LastEdited', 'DESC')
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $testWords = array_unique($testWords);
440 440
             foreach ($testWords as $wordKey => $word) {
441 441
                 //match a exact field to full words / one word
442
-                $fullWords = ! (bool) $wordKey;
442
+                $fullWords = !(bool) $wordKey;
443 443
                 if (false === $done) {
444 444
                     $count = 0;
445 445
                     foreach ($fieldValues as $fieldValue) {
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
             $this->words[] = $word;
516 516
         }
517 517
 
518
-        if (! count($this->words)) {
518
+        if (!count($this->words)) {
519 519
             user_error('No word has been provided');
520 520
         }
521 521
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             DB::alteration_message('Base Class: ' . $this->baseClass);
533 533
         }
534 534
 
535
-        if (! isset($this->cache['AllDataObjects'][$this->baseClass])) {
535
+        if (!isset($this->cache['AllDataObjects'][$this->baseClass])) {
536 536
             $this->cache['AllDataObjects'][$this->baseClass] = array_values(
537 537
                 ClassInfo::subclassesFor($this->baseClass, false)
538 538
             );
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
     protected function getAllValidFields(string $className): array
546 546
     {
547
-        if (! isset($this->cache['AllValidFields'][$className])) {
547
+        if (!isset($this->cache['AllValidFields'][$className])) {
548 548
             $array = [];
549 549
             $fullList = Config::inst()->get($className, 'db');
550 550
             if (is_array($fullList)) {
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 
571 571
     protected function getIndexedFields(string $className, array $dbFields): array
572 572
     {
573
-        if (! isset($this->cache['IndexedFields'][$className])) {
573
+        if (!isset($this->cache['IndexedFields'][$className])) {
574 574
             $this->cache['IndexedFields'][$className] = [];
575 575
             $indexes = Config::inst()->get($className, 'indexes');
576 576
             if (is_array($indexes)) {
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 
606 606
     protected function isValidFieldType(string $className, string $fieldName, string $type): bool
607 607
     {
608
-        if (! isset($this->cache['ValidFieldTypes'][$type])) {
608
+        if (!isset($this->cache['ValidFieldTypes'][$type])) {
609 609
             $this->cache['ValidFieldTypes'][$type] = false;
610 610
             $singleton = Injector::inst()->get($className);
611 611
             $field = $singleton->dbObject($fieldName);
Please login to merge, or discard this patch.
src/Tasks/SiteWideSearch.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Admin/SearchAdmin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.