Passed
Push — master ( 27e0ff...8f0a74 )
by Nicolaas
07:55
created
src/Api/DefaultDashboardProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             $pageCount = $pageClassName::get()->filter(['ClassName' => $pageClassName])->count();
95 95
             if ($pageCount < 1) {
96 96
                 $page = Injector::inst()->get($pageClassName);
97
-                if($page->canCreate()) {
97
+                if ($page->canCreate()) {
98 98
                     $pageTitle = $page->i18n_singular_name();
99 99
                     $pagesArray[] = [
100 100
                         'Title' => DashboardWelcomeQuicklinks::get_base_phrase('add') . ' ' . $pageTitle . ' (0)',
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
                 }
106 106
             } elseif ($pageCount === 1) {
107 107
                 $page = DataObject::get_one($pageClassName, ['ClassName' => $pageClassName]);
108
-                if($page->canEdit()) {
108
+                if ($page->canEdit()) {
109 109
                     $pageTitle = $page->i18n_singular_name();
110 110
                     $insideLink = [];
111
-                    if($page->canCreate()) {
111
+                    if ($page->canCreate()) {
112 112
                         $insideLink = [
113 113
                             'Title' => DashboardWelcomeQuicklinks::get_base_phrase('add'),
114 114
                             'Link' => 'admin/pages/add?PageType=' . $pageClassName,
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
                 }
124 124
             } else {
125 125
                 $page = Injector::inst()->get($pageClassName);
126
-                if($page->canEdit()) {
126
+                if ($page->canEdit()) {
127 127
                     $pageTitle = $page->i18n_plural_name();
128 128
                     $query = 'q[ClassName]=' . $pageClassName;
129 129
                     $link = 'admin/pages?' . $query;
130 130
                     $insideLink = [];
131
-                    if($page->canCreate()) {
131
+                    if ($page->canCreate()) {
132 132
                         $insideLink = [
133 133
                             'Title' => DashboardWelcomeQuicklinks::get_base_phrase('add'),
134 134
                             'Link' => 'admin/pages/add?PageType=' . $pageClassName,
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             }
145 145
         }
146 146
         $pagesArray = $this->sortByCountAndTitle($pagesArray);
147
-        foreach($pagesArray as $pageClassName => $pageArray) {
147
+        foreach ($pagesArray as $pageClassName => $pageArray) {
148 148
             DashboardWelcomeQuicklinks::add_link('PAGEFILTER', $pageArray['Title'], $pageArray['Link'], $pageArray['InsideLink']);
149 149
         }
150 150
 
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
                             $title = $title['title'];
256 256
                             $model = $title['dataClass'] ?? $model;
257 257
                         }
258
-                        if (! class_exists($model)) {
258
+                        if (!class_exists($model)) {
259 259
                             continue;
260 260
                         }
261 261
                         $obj = Injector::inst()->get($model);
262 262
                         if ($obj && $obj->canView()) {
263
-                            if (! $groupAdded) {
263
+                            if (!$groupAdded) {
264 264
                                 DashboardWelcomeQuicklinks::add_group($groupCode, $ma->menu_title(), 100);
265 265
                                 $groupAdded = true;
266 266
                             }
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
                             $ma = ReflectionHelper::allowAccessToProperty(get_class($ma), 'modelClass');
269 269
                             $ma->modelClass = $model;
270 270
                             $list = $ma->getList();
271
-                            if (! $list) {
271
+                            if (!$list) {
272 272
                                 $list = $model::get();
273 273
                             }
274 274
                             $objectCount = $list->count();
275 275
                             if ($objectCount === 1) {
276 276
                                 $baseTable = Injector::inst()->get($model)->baseTable();
277 277
                                 $obj = DataObject::get_one($model, [$baseTable . '.ClassName' => $model]);
278
-                                if (! $obj) {
278
+                                if (!$obj) {
279 279
                                     $obj = DataObject::get_one($model);
280 280
                                 }
281 281
                                 if ($obj && $obj->hasMethod('CMSEditLink')) {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                             $link = '';
291 291
                             if ($obj->hasMethod('CMSListLink')) {
292 292
                                 $link = $obj->CMSListLink();
293
-                            } if (! $link) {
293
+                            } if (!$link) {
294 294
                                 $link = $ma->getLinkForModelTab($model);
295 295
                             }
296 296
                             $titleContainsObjectCount = strpos($title, ' (' . $objectCount . ')');
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
     protected function sortByCountAndTitle(array $array): array
331 331
     {
332
-        usort($array, function ($a, $b) {
332
+        usort($array, function($a, $b) {
333 333
             $countComparison = $b['Count'] <=> $a['Count'];
334 334
             if ($countComparison === 0) {
335 335
                 return $a['Title'] <=> $b['Title'];
Please login to merge, or discard this patch.