Passed
Push — master ( 3cb69a...782ded )
by Nicolaas
03:32
created
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/Helpers/FindEditableObjects.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -285,8 +285,8 @@
 block discarded – undo
285 285
 
286 286
     protected function classCanBeIncluded(string $dataObjectClassName): bool
287 287
     {
288
-        if(count($this->excludedClasses) || count($this->includedClasses)) {
289
-            if(!class_exists($dataObjectClassName)) {
288
+        if (count($this->excludedClasses) || count($this->includedClasses)) {
289
+            if (!class_exists($dataObjectClassName)) {
290 290
                 return false;
291 291
             }
292 292
             if (count($this->includedClasses)) {
Please login to merge, or discard this patch.
src/Admin/SearchAdmin.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
                 _t(__CLASS__ . '.ReplaceToggle', 'Replace with ... (optional - make a backup first!)'),
91 91
                 [
92 92
                     (new CheckboxField('ApplyReplace', 'Run replace (please make sure to make a backup first!)', $this->applyReplace))
93
-                      ->setDescription('Check this to replace the searched value set above with its replacement value. Note that searches ignore uppercase / lowercase, but replace actions will only search and replace values with the same upper / lowercase.'),
93
+                        ->setDescription('Check this to replace the searched value set above with its replacement value. Note that searches ignore uppercase / lowercase, but replace actions will only search and replace values with the same upper / lowercase.'),
94 94
                     (new TextField('ReplaceWith', 'Replace (optional - careful!)', $this->replace ?? ''))
95 95
                         ->setAttribute('placeholder', 'e.g. contract - make sure to also tick checkbox below'),
96 96
                 ]
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
     protected function init()
58 58
     {
59
-        if($this->request->param('Action')) {
60
-            if(empty($this->request->postVars())) {
59
+        if ($this->request->param('Action')) {
60
+            if (empty($this->request->postVars())) {
61 61
                 $this->redirect('/admin/find');
62 62
             }
63 63
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         if (!$this->getRequest()->requestVar('Keywords')) {
112 112
             $lastResults = $this->lastSearchResults();
113
-            if($lastResults) {
113
+            if ($lastResults) {
114 114
                 $resultsTitle = 'Last Results';
115 115
             } else {
116 116
                 $resultsTitle = 'Last Edited';
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
         Environment::increaseTimeLimitTo(300);
181 181
         Environment::setMemoryLimitMax(-1);
182 182
         Environment::increaseMemoryLimitTo(-1);
183
-        if(empty($this->rawData)) {
183
+        if (empty($this->rawData)) {
184 184
             $lastResults = $this->lastSearchResults();
185
-            if($lastResults) {
185
+            if ($lastResults) {
186 186
                 return $lastResults;
187 187
             }
188 188
         }
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
             ->setWordsAsString($this->keywords)
209 209
             ->getLinks()
210 210
         ;
211
-        if($results->count() === 1) {
211
+        if ($results->count() === 1) {
212 212
             $result = $results->first();
213 213
             $this->redirect($result->CMSEditLink);
214 214
             return null;
215 215
         }
216 216
         // Accessing the session
217 217
         $session = $this->getRequest()->getSession();
218
-        if($session) {
218
+        if ($session) {
219 219
             $session->set('QuickSearchLastResults', serialize($results->toArray()));
220 220
         }
221 221
         return $results;
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
     {
247 247
         // Accessing the session
248 248
         $session = $this->getRequest()->getSession();
249
-        if($this->quickSearchType) {
249
+        if ($this->quickSearchType) {
250 250
             $session->set('QuickSearchType', $this->quickSearchType);
251
-        } elseif($session) {
251
+        } elseif ($session) {
252 252
             $this->quickSearchType = $session->get('QuickSearchType');
253
-            if(isset($_GET['flush'])) {
253
+            if (isset($_GET['flush'])) {
254 254
                 $this->quickSearchType = '';
255 255
                 $session->set('QuickSearchType', '');
256 256
             }
257 257
         }
258
-        if(!$this->quickSearchType) {
258
+        if (!$this->quickSearchType) {
259 259
             $this->quickSearchType = $this->Config()->get('default_quick_search_type');
260 260
         }
261 261
         return (string) $this->quickSearchType;
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
     {
266 266
         // Accessing the session
267 267
         $session = $this->getRequest()->getSession();
268
-        if($session) {
269
-            if(isset($_GET['flush'])) {
268
+        if ($session) {
269
+            if (isset($_GET['flush'])) {
270 270
                 $session->clear('QuickSearchLastResults');
271 271
             } else {
272 272
                 $data = $session->get('QuickSearchLastResults');
273
-                if($data) {
273
+                if ($data) {
274 274
                     $array = unserialize($data);
275 275
                     $al = ArrayList::create();
276
-                    foreach($array as $item) {
276
+                    foreach ($array as $item) {
277 277
                         $al->push($item);
278 278
                     }
279 279
                     return $al;
Please login to merge, or discard this patch.
src/QuickSearches/QuickSearchBaseClass.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
             'limited' => 'Limited search',
33 33
         ];
34 34
         $availableSearchClasses = self::available_quick_searches();
35
-        if(!empty($availableSearchClasses) > 0) {
36
-            foreach($availableSearchClasses as $availableSearchClass) {
37
-                $array[$availableSearchClass] =  Injector::inst()->get($availableSearchClass)->getTitle();
35
+        if (!empty($availableSearchClasses) > 0) {
36
+            foreach ($availableSearchClasses as $availableSearchClass) {
37
+                $array[$availableSearchClass] = Injector::inst()->get($availableSearchClass)->getTitle();
38 38
             }
39 39
         }
40 40
         return $array;
Please login to merge, or discard this patch.
src/Api/SearchApi.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 
142 142
     public function setQuickSearchType(string $s): SearchApi
143 143
     {
144
-        if($s === 'all') {
144
+        if ($s === 'all') {
145 145
             $this->isQuickSearch = false;
146 146
             $this->quickSearchType = '';
147
-        } elseif($s === 'limited') {
147
+        } elseif ($s === 'limited') {
148 148
             $this->isQuickSearch = true;
149 149
             $this->quickSearchType = '';
150
-        } elseif(class_exists($s)) {
150
+        } elseif (class_exists($s)) {
151 151
             $this->quickSearchType = $s;
152 152
             $object = Injector::inst()->get($s);
153 153
             $this->setIncludedClasses($object->getClassesToSearch());
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                 if ($this->debug) {
364 364
                     DB::alteration_message(' ... Searching in ' . $className);
365 365
                 }
366
-                if(count($this->includedClasses) && !in_array($className, $this->includedClasses, true)) {
366
+                if (count($this->includedClasses) && !in_array($className, $this->includedClasses, true)) {
367 367
                     continue;
368 368
                 }
369 369
                 if (!in_array($className, $this->excludedClasses, true)) {
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
                     $fields = $this->getAllValidFields($className);
373 373
                     $filterAny = [];
374 374
                     foreach ($fields as $field) {
375
-                        if(count($this->includedClassFieldCombos) && isset($this->includedClassFieldCombos[$className][$field])) {
375
+                        if (count($this->includedClassFieldCombos) && isset($this->includedClassFieldCombos[$className][$field])) {
376 376
                             // all good
377
-                        } elseif(count($this->includedFields) && in_array($field, $this->includedFields, true)) {
377
+                        } elseif (count($this->includedFields) && in_array($field, $this->includedFields, true)) {
378 378
                             // all good
379 379
                         } elseif (!in_array($field, $this->excludedFields, true)) {
380 380
                             // all good
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         $array = [];
438 438
         $classNames = $this->getAllDataObjects();
439 439
         foreach ($classNames as $className) {
440
-            if(count($this->includedClasses) && !in_array($className, $this->includedClasses, true)) {
440
+            if (count($this->includedClasses) && !in_array($className, $this->includedClasses, true)) {
441 441
                 continue;
442 442
             }
443 443
             if (!in_array($className, $this->excludedClasses, true)) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
         $items = $this->turnArrayIntoObjects($matches);
509 509
         foreach ($items as $item) {
510 510
             $link = $finder->getLink($item, $this->excludedClasses);
511
-            if($item->canView()) {
511
+            if ($item->canView()) {
512 512
                 $cmsEditLink = $item->canEdit() ? $finder->getCMSEditLink($item) : '';
513 513
                 $list->push(
514 514
                     ArrayData::create(
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
         }
530 530
 
531 531
         $finder->saveCache();
532
-        if(!empty($this->sortOverride)) {
532
+        if (!empty($this->sortOverride)) {
533 533
             return $list->sort($this->sortOverride);
534 534
         } else {
535 535
             return $list->sort(['SiteWideSearchSortValue' => 'ASC']);
@@ -696,12 +696,12 @@  discard block
 block discarded – undo
696 696
             foreach ($fullList as $name => $type) {
697 697
                 if ($this->isValidFieldType($className, $name, $type)) {
698 698
                     $array[] = $name;
699
-                } elseif(in_array($name, $this->includedFields, true)) {
699
+                } elseif (in_array($name, $this->includedFields, true)) {
700 700
                     $array[] = $name;
701 701
                 }
702 702
             }
703
-            if(isset($this->includedClassFieldCombos[$className])) {
704
-                foreach($this->includedClassFieldCombos[$className] as $name => $type) {
703
+            if (isset($this->includedClassFieldCombos[$className])) {
704
+                foreach ($this->includedClassFieldCombos[$className] as $name => $type) {
705 705
                     $array[] = $name;
706 706
                 }
707 707
             }
Please login to merge, or discard this patch.