Passed
Push — master ( 7308b3...27e0ff )
by Nicolaas
02:27
created
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.