Test Setup Failed
Branch master (78b43f)
by Nicolaas
07:50
created
Category
src/Admin/SearchAdmin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
             (new CheckboxField('QuickSearch', 'Search Main Fields Only', $this->isQuickSearch))
57 57
                 ->setDescription('This is faster but only searches a limited number of fields')
58 58
         );
59
-        if (! $this->getRequest()->requestVar('Keywords')) {
59
+        if (!$this->getRequest()->requestVar('Keywords')) {
60 60
             $resultsTitle = 'Recently Edited';
61 61
             $this->listHTML = $this->renderWith(self::class . '_Results');
62 62
         } else {
Please login to merge, or discard this patch.
src/Helpers/FindEditableObjects.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
             }
173 173
             return (string) $dataObject->{$validMethod};
174 174
         }
175
-        if (! in_array($dataObject->ClassName, $this->excludedClasses, true)) {
175
+        if (!in_array($dataObject->ClassName, $this->excludedClasses, true)) {
176 176
             if (empty($this->cache[$type][$dataObject->ClassName]) || $this->cache[$type][$dataObject->ClassName] !== true) {
177 177
                 foreach ($validMethods as $validMethod) {
178 178
                     $outcome = null;
179 179
                     if ($dataObject->hasMethod($validMethod)) {
180 180
                         $outcome = $dataObject->{$validMethod}();
181
-                    } elseif (! empty($dataObject->{$validMethod})) {
181
+                    } elseif (!empty($dataObject->{$validMethod})) {
182 182
                         $outcome = $dataObject->{$validMethod};
183 183
                     }
184 184
                     if ($outcome) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             if (is_array($relType)) {
207 207
                 continue;
208 208
             }
209
-            if (! isset($this->relationTypesCovered[$relType])) {
209
+            if (!isset($this->relationTypesCovered[$relType])) {
210 210
                 $rels = $dataObject->{$relationName}();
211 211
                 if ($rels) {
212 212
                     if ($rels instanceof DataList) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
     protected function getRelations($dataObject): array
234 234
     {
235
-        if (! isset($this->cache['rels'][$dataObject->ClassName])) {
235
+        if (!isset($this->cache['rels'][$dataObject->ClassName])) {
236 236
             $this->cache['rels'][$dataObject->ClassName] = array_merge(
237 237
                 Config::inst()->get($dataObject->ClassName, 'belongs_to'),
238 238
                 Config::inst()->get($dataObject->ClassName, 'has_one'),
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
                 Config::inst()->get($dataObject->ClassName, 'belongs_many_many'),
241 241
                 Config::inst()->get($dataObject->ClassName, 'many_many')
242 242
             );
243
-            foreach($this->cache['rels'][$dataObject->ClassName] as $key => $value) {
244
-                if (! in_array($value, $this->excludedClasses, true)) {
243
+            foreach ($this->cache['rels'][$dataObject->ClassName] as $key => $value) {
244
+                if (!in_array($value, $this->excludedClasses, true)) {
245 245
                     unset($this->cache['rels'][$dataObject->ClassName][$key]);
246 246
                 }
247 247
             }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
     protected function getValidMethods(string $type): array
254 254
     {
255
-        if (! isset($this->cache['validMethods'][$type])) {
255
+        if (!isset($this->cache['validMethods'][$type])) {
256 256
             $this->cache['validMethods'][$type] = $this->Config()->get($type);
257 257
         }
258 258
 
Please login to merge, or discard this patch.
src/Api/SearchApi.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
         if (count($this->words)) {
212 212
             foreach ($this->getAllDataObjects() as $className) {
213 213
                 // if ($this->debug) {DB::alteration_message(' ... Searching in ' . $className);}
214
-                if (! in_array($className, $this->excludedClasses, true)) {
214
+                if (!in_array($className, $this->excludedClasses, true)) {
215 215
                     $array[$className] = [];
216 216
                     $fields = $this->getAllValidFields($className);
217 217
                     $filterAny = [];
218 218
                     foreach ($fields as $field) {
219
-                        if (! in_array($field, $this->excludedFields, true)) {
219
+                        if (!in_array($field, $this->excludedFields, true)) {
220 220
                             // if ($this->debug) {DB::alteration_message(' ... ... Searching in ' . $className . '.' . $field);}
221 221
                             $filterAny[$field . ':PartialMatch'] = $this->words;
222 222
                         }
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
         $back = $this->config()->get('hours_back_for_recent') ?? 24;
246 246
         $limit = $this->Config()->get('limit_per_class_for_recent') ?? 5;
247 247
         $threshold = strtotime('-' . $back . ' hours', DBDatetime::now()->getTimestamp());
248
-        if (! $threshold) {
248
+        if (!$threshold) {
249 249
             $threshold = time() - 86400;
250 250
         }
251 251
         $array = [];
252 252
         $classNames = $this->getAllDataObjects();
253 253
         foreach ($classNames as $className) {
254
-            if (! in_array($className, $this->excludedClasses, true)) {
254
+            if (!in_array($className, $this->excludedClasses, true)) {
255 255
                 $array[$className] = $className::get()
256 256
                     ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold))
257 257
                     ->sort('LastEdited', 'DESC')
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         if ($word) {
398 398
             $this->words[] = $word;
399 399
         }
400
-        if (! count($this->words)) {
400
+        if (!count($this->words)) {
401 401
             user_error('No word has been provided');
402 402
         }
403 403
         $this->words = array_unique($this->words);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
     protected function getAllDataObjects(): array
411 411
     {
412 412
         // if ($this->debug) {DB::alteration_message('Base Class: ' . $this->baseClass);}
413
-        if (! isset($this->cache['AllDataObjects'][$this->baseClass])) {
413
+        if (!isset($this->cache['AllDataObjects'][$this->baseClass])) {
414 414
             $this->cache['AllDataObjects'][$this->baseClass] = array_values(
415 415
                 ClassInfo::subclassesFor($this->baseClass, false)
416 416
             );
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
     protected function getAllValidFields(string $className): array
424 424
     {
425
-        if (! isset($this->cache['AllValidFields'][$className])) {
425
+        if (!isset($this->cache['AllValidFields'][$className])) {
426 426
             $array = [];
427 427
             $fullList = Config::inst()->get($className, 'db');
428 428
             if (is_array($fullList)) {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
     protected function getIndexedFields(string $className, array $dbFields): array
447 447
     {
448
-        if (! isset($this->cache['IndexedFields'][$className])) {
448
+        if (!isset($this->cache['IndexedFields'][$className])) {
449 449
             $this->cache['IndexedFields'][$className] = [];
450 450
             $indexes = Config::inst()->get($className, 'indexes');
451 451
             if (is_array($indexes)) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
     protected function isValidFieldType(string $className, string $fieldName, string $type): bool
481 481
     {
482
-        if (! isset($this->cache['ValidFieldTypes'][$type])) {
482
+        if (!isset($this->cache['ValidFieldTypes'][$type])) {
483 483
             $this->cache['ValidFieldTypes'][$type] = false;
484 484
             $singleton = Injector::inst()->get($className);
485 485
             $field = $singleton->dbObject($fieldName);
Please login to merge, or discard this patch.