Passed
Push — master ( 7308b3...27e0ff )
by Nicolaas
02:27
created
src/Api/DefaultDashboardProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
                             $title = $title['title'];
179 179
                             $model = $title['dataClass'] ?? $model;
180 180
                         }
181
-                        if (! class_exists($model)) {
181
+                        if (!class_exists($model)) {
182 182
                             continue;
183 183
                         }
184 184
                         $obj = Injector::inst()->get($model);
185 185
                         if ($obj && $obj->canView()) {
186
-                            if (! $groupAdded) {
186
+                            if (!$groupAdded) {
187 187
                                 DashboardWelcomeQuicklinks::add_group($groupCode, $ma->menu_title(), 100);
188 188
                                 $groupAdded = true;
189 189
                             }
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
                             $ma = ReflectionHelper::allowAccessToProperty(get_class($ma), 'modelClass');
192 192
                             $ma->modelClass = $model;
193 193
                             $list = $ma->getList();
194
-                            if (! $list) {
194
+                            if (!$list) {
195 195
                                 $list = $model::get();
196 196
                             }
197 197
                             $objectCount = $list->count();
198 198
                             if ($objectCount === 1) {
199 199
                                 $baseTable = Injector::inst()->get($model)->baseTable();
200 200
                                 $obj = DataObject::get_one($model, [$baseTable . '.ClassName' => $model]);
201
-                                if (! $obj) {
201
+                                if (!$obj) {
202 202
                                     $obj = DataObject::get_one($model);
203 203
                                 }
204 204
                                 if ($obj && $obj->hasMethod('CMSEditLink')) {
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                             $link = '';
214 214
                             if ($obj->hasMethod('CMSListLink')) {
215 215
                                 $link = $obj->CMSListLink();
216
-                            } if (! $link) {
216
+                            } if (!$link) {
217 217
                                 $link = $ma->getLinkForModelTab($model);
218 218
                             }
219 219
                             $titleContainsObjectCount = strpos($title, ' (' . $objectCount . ')');
Please login to merge, or discard this patch.
src/Admin/DashboardWelcomeQuickLinks.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public static function get_base_phrase(string $phrase): string
55 55
     {
56
-        if (! in_array($phrase, ['add', 'review', 'edit', 'more'])) {
56
+        if (!in_array($phrase, ['add', 'review', 'edit', 'more'])) {
57 57
             user_error('Phrase must be one of "add", "review", or "edit"', E_USER_ERROR);
58 58
         }
59 59
         $phrase = Config::inst()->get(static::class, $phrase . '_phrase');
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
             usort(
186 186
                 $shortcuts,
187
-                function ($a, $b) {
187
+                function($a, $b) {
188 188
                     $b['SortOrder'] ?? 0;
189 189
                     $a['SortOrder'] ?? 0;
190 190
                 }
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 
193 193
             foreach ($shortcuts as $groupCode => $groupDetails) {
194 194
                 $colour = '';
195
-                if (! empty($groupDetails['Colour'])) {
195
+                if (!empty($groupDetails['Colour'])) {
196 196
                     $colour = 'style="background-color: ' . $groupDetails['Colour'] . '"';
197 197
                 }
198 198
                 $icon = '';
199
-                if (! empty($groupDetails['IconClass'])) {
199
+                if (!empty($groupDetails['IconClass'])) {
200 200
                     $icon = '<i class="' . $groupDetails['IconClass'] . '"></i> ';
201 201
                 }
202 202
                 $html .= '
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                     </div>
207 207
                     <div class="entries">';
208 208
                 $items = $groupDetails['Items'] ?? [];
209
-                if (! empty($entry['Link']) && class_exists($entry['Link'])) {
209
+                if (!empty($entry['Link']) && class_exists($entry['Link'])) {
210 210
                     $obj = Injector::inst()->get($entry['Link']);
211 211
                     if ($obj instanceof DataObject) {
212 212
                         $entry['Link'] = DataObject::get_one($entry['Link'])->CMSEditLink();
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         return $array;
269 269
     }
270 270
 
271
-    protected function makeShortCut(array $entry, ?bool $isInsideLink = false): LiteralField|string
271
+    protected function makeShortCut(array $entry, ?bool $isInsideLink = false): LiteralField | string
272 272
     {
273 273
         $title = (string) $entry['Title'];
274 274
         $link = (string) $entry['Link'];
@@ -291,31 +291,31 @@  discard block
 block discarded – undo
291 291
         if ($iconClass !== null && $iconClass !== '' && $iconClass !== '0') {
292 292
             $icon = '<i class="' . $iconClass . '"></i> ';
293 293
         }
294
-        if (! $target) {
294
+        if (!$target) {
295 295
             $target = '_self';
296 296
         }
297
-        if($isInsideLink) {
297
+        if ($isInsideLink) {
298 298
             $tag = 'span';
299 299
         } else {
300 300
             $tag = 'h2';
301 301
         }
302
-        if($class) {
303
-            $class = ' class="'.$class.'"';
302
+        if ($class) {
303
+            $class = ' class="' . $class . '"';
304 304
         }
305 305
         $insideLinkHTML = '';
306
-        if(!empty($insideLink)) {
307
-            $insideLink['Class'] = ($insideLink['Class'] ?? '').' inside-link';
306
+        if (!empty($insideLink)) {
307
+            $insideLink['Class'] = ($insideLink['Class'] ?? '') . ' inside-link';
308 308
             $insideLinkHTML = $this->makeShortCut($insideLink, true);
309 309
         }
310 310
         $target = ' target="' . $target . '"';
311 311
         if ($link !== '' && $link !== '0') {
312
-            $html = '' . $script . '<'.$tag.'' . $class . '>' . $icon . '<a href="' . $link . '" ' . $target . ' ' . $onclick . '>' . $title . '</a>'.$insideLinkHTML .'</'.$tag.'>';
312
+            $html = '' . $script . '<' . $tag . '' . $class . '>' . $icon . '<a href="' . $link . '" ' . $target . ' ' . $onclick . '>' . $title . '</a>' . $insideLinkHTML . '</' . $tag . '>';
313 313
         } else {
314
-            $html = '' . $script . '<'.$tag.'' . $class . '>' . $title . '' . $insideLinkHTML . '</'.$tag.'>
314
+            $html = '' . $script . '<' . $tag . '' . $class . '>' . $title . '' . $insideLinkHTML . '</' . $tag . '>
315 315
             ';
316 316
         }
317 317
         $html = preg_replace('/\s+/', ' ', $html);
318
-        if($isInsideLink) {
318
+        if ($isInsideLink) {
319 319
             return $html;
320 320
         } else {
321 321
             return LiteralField::create($name, $html);
Please login to merge, or discard this patch.