Passed
Push — main ( d6316c...aeb638 )
by Nicolaas
08:55 queued 06:45
created
src/Control/LeftAndMainDarkThemeToggle.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      *
45 45
      * @return HTTPResponse
46 46
      */
47
-    public function switch($request)
47
+    public function switch ($request)
48 48
     {
49 49
         $owner = $this->getOwner();
50 50
         if (LeftAndMainDarkThemeApi::is_dark_mode()) {
Please login to merge, or discard this patch.
src/Api/LeftAndMainDarkThemeApi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public static function set_display_mode(string $mode): void
35 35
     {
36
-        if (! self::is_valid_display_mode_setting((string) $mode)) {
36
+        if (!self::is_valid_display_mode_setting((string) $mode)) {
37 37
             user_error('Setting must be Dark or Light');
38 38
         }
39 39
         $member = Security::getCurrentUser();
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
             $config = SiteConfig::current_site_config();
57 57
             if (self::is_valid_display_mode_setting((string) $config->DarkModeSetting)) {
58 58
                 self::$darkModeSetInDatabaseCache = true;
59
-                if (! self::$darkModeValueCache) {
59
+                if (!self::$darkModeValueCache) {
60 60
                     self::$darkModeValueCache = (string) $config->DarkModeSetting;
61 61
                 }
62 62
             }
63
-            if (! self::is_valid_display_mode_setting((string) self::$darkModeValueCache)) {
63
+            if (!self::is_valid_display_mode_setting((string) self::$darkModeValueCache)) {
64 64
                 self::$darkModeValueCache = '';
65 65
             }
66 66
         }
@@ -80,6 +80,6 @@  discard block
 block discarded – undo
80 80
 
81 81
     public static function is_valid_display_mode_setting(string $mode): bool
82 82
     {
83
-        return in_array($mode, ['Dark', 'Light'], true);
83
+        return in_array($mode, [ 'Dark', 'Light' ], true);
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
src/Admin/Extensions/LeftAndMainDarkTheme.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         // use browser setting.
48 48
         $css = '';
49 49
         if (false === LeftAndMainDarkThemeApi::get_is_dark_mode_set_in_database()) {
50
-            $css .= '@media (prefers-color-scheme: dark) {' . $makeDarkCss . '}';
50
+            $css .= '@media (prefers-color-scheme: dark) {'.$makeDarkCss.'}';
51 51
         } elseif (LeftAndMainDarkThemeApi::is_dark_mode()) {
52 52
             $css .= $makeDarkCss;
53 53
         }
Please login to merge, or discard this patch.
src/Model/Extensions/DarkThemePreference.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function populateDefaults()
74 74
     {
75
-        $this->Title = _t(self::class . '.SITENAMEDEFAULT', "Your Site Name");
76
-        $this->Tagline = _t(self::class . '.TAGLINEDEFAULT', "your tagline here");
75
+        $this->Title = _t(self::class.'.SITENAMEDEFAULT', "Your Site Name");
76
+        $this->Tagline = _t(self::class.'.TAGLINEDEFAULT', "your tagline here");
77 77
 
78 78
         // Allow these defaults to be overridden
79 79
         parent::populateDefaults();
@@ -88,35 +88,35 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function getCMSFields()
90 90
     {
91
-        $mapFn = function ($groups = []) {
92
-            $map = [];
91
+        $mapFn = function($groups = [ ]) {
92
+            $map = [ ];
93 93
             foreach ($groups as $group) {
94 94
                 // Listboxfield values are escaped, use ASCII char instead of »
95
-                $map[$group->ID] = $group->getBreadcrumbs(' > ');
95
+                $map[ $group->ID ] = $group->getBreadcrumbs(' > ');
96 96
             }
97 97
             asort($map);
98 98
             return $map;
99 99
         };
100 100
         $groupsMap = $mapFn(Group::get());
101
-        $viewAllGroupsMap = $mapFn(Permission::get_groups_by_permission(['SITETREE_VIEW_ALL', 'ADMIN']));
102
-        $editAllGroupsMap = $mapFn(Permission::get_groups_by_permission(['SITETREE_EDIT_ALL', 'ADMIN']));
101
+        $viewAllGroupsMap = $mapFn(Permission::get_groups_by_permission([ 'SITETREE_VIEW_ALL', 'ADMIN' ]));
102
+        $editAllGroupsMap = $mapFn(Permission::get_groups_by_permission([ 'SITETREE_EDIT_ALL', 'ADMIN' ]));
103 103
 
104 104
         $fields = FieldList::create(
105 105
             TabSet::create(
106 106
                 "Root",
107 107
                 $tabMain = Tab::create(
108 108
                     'Main',
109
-                    $titleField = TextField::create("Title", _t(self::class . '.SITETITLE', "Site title")),
109
+                    $titleField = TextField::create("Title", _t(self::class.'.SITETITLE', "Site title")),
110 110
                     $taglineField = TextField::create(
111 111
                         "Tagline",
112
-                        _t(self::class . '.SITETAGLINE', "Site Tagline/Slogan")
112
+                        _t(self::class.'.SITETAGLINE', "Site Tagline/Slogan")
113 113
                     )
114 114
                 ),
115 115
                 $tabAccess = Tab::create(
116 116
                     'Access',
117 117
                     $viewersOptionsField = OptionsetField::create(
118 118
                         "CanViewType",
119
-                        _t(self::class . '.VIEWHEADER', "Who can view pages on this site?")
119
+                        _t(self::class.'.VIEWHEADER', "Who can view pages on this site?")
120 120
                     ),
121 121
                     $viewerGroupsField = ListboxField::create(
122 122
                         "ViewerGroups",
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                         ),
130 130
                     $editorsOptionsField = OptionsetField::create(
131 131
                         "CanEditType",
132
-                        _t(self::class . '.EDITHEADER', "Who can edit pages on this site?")
132
+                        _t(self::class.'.EDITHEADER', "Who can edit pages on this site?")
133 133
                     ),
134 134
                     $editorGroupsField = ListboxField::create(
135 135
                         "EditorGroups",
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
                         ),
143 143
                     $topLevelCreatorsOptionsField = OptionsetField::create(
144 144
                         "CanCreateTopLevelType",
145
-                        _t(self::class . '.TOPLEVELCREATE', "Who can create pages in the root of the site?")
145
+                        _t(self::class.'.TOPLEVELCREATE', "Who can create pages in the root of the site?")
146 146
                     ),
147 147
                     $topLevelCreatorsGroupsField = ListboxField::create(
148 148
                         "CreateTopLevelGroups",
149
-                        _t(self::class . '.TOPLEVELCREATORGROUPS', "Top level creators")
149
+                        _t(self::class.'.TOPLEVELCREATORGROUPS', "Top level creators")
150 150
                     )
151 151
                         ->setSource($groupsMap)
152 152
                         ->setAttribute(
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
             HiddenField::create('ID')
159 159
         );
160 160
 
161
-        $viewersOptionsSource = [];
162
-        $viewersOptionsSource["Anyone"] = _t('SilverStripe\\CMS\\Model\\SiteTree.ACCESSANYONE', "Anyone");
163
-        $viewersOptionsSource["LoggedInUsers"] = _t(
161
+        $viewersOptionsSource = [ ];
162
+        $viewersOptionsSource[ "Anyone" ] = _t('SilverStripe\\CMS\\Model\\SiteTree.ACCESSANYONE', "Anyone");
163
+        $viewersOptionsSource[ "LoggedInUsers" ] = _t(
164 164
             'SilverStripe\\CMS\\Model\\SiteTree.ACCESSLOGGEDIN',
165 165
             "Logged-in users"
166 166
         );
167
-        $viewersOptionsSource["OnlyTheseUsers"] = _t(
167
+        $viewersOptionsSource[ "OnlyTheseUsers" ] = _t(
168 168
             'SilverStripe\\CMS\\Model\\SiteTree.ACCESSONLYTHESE',
169 169
             "Only these groups (choose from list)"
170 170
         );
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             $viewerGroupsField->setDescription(_t(
175 175
                 'SilverStripe\\CMS\\Model\\SiteTree.VIEWER_GROUPS_FIELD_DESC',
176 176
                 'Groups with global view permissions: {groupList}',
177
-                ['groupList' => implode(', ', array_values($viewAllGroupsMap))]
177
+                [ 'groupList' => implode(', ', array_values($viewAllGroupsMap)) ]
178 178
             ));
179 179
         }
180 180
 
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
             $editorGroupsField->setDescription(_t(
183 183
                 'SilverStripe\\CMS\\Model\\SiteTree.EDITOR_GROUPS_FIELD_DESC',
184 184
                 'Groups with global edit permissions: {groupList}',
185
-                ['groupList' => implode(', ', array_values($editAllGroupsMap))]
185
+                [ 'groupList' => implode(', ', array_values($editAllGroupsMap)) ]
186 186
             ));
187 187
         }
188 188
 
189
-        $editorsOptionsSource = [];
190
-        $editorsOptionsSource["LoggedInUsers"] = _t(
189
+        $editorsOptionsSource = [ ];
190
+        $editorsOptionsSource[ "LoggedInUsers" ] = _t(
191 191
             'SilverStripe\\CMS\\Model\\SiteTree.EDITANYONE',
192 192
             "Anyone who can log-in to the CMS"
193 193
         );
194
-        $editorsOptionsSource["OnlyTheseUsers"] = _t(
194
+        $editorsOptionsSource[ "OnlyTheseUsers" ] = _t(
195 195
             'SilverStripe\\CMS\\Model\\SiteTree.EDITONLYTHESE',
196 196
             "Only these groups (choose from list)"
197 197
         );
@@ -210,22 +210,22 @@  discard block
 block discarded – undo
210 210
             $fields->makeFieldReadonly($titleField);
211 211
         }
212 212
 
213
-        if (file_exists(BASE_PATH . '/install.php')) {
213
+        if (file_exists(BASE_PATH.'/install.php')) {
214 214
             $fields->addFieldToTab(
215 215
                 'Root.Main',
216 216
                 LiteralField::create(
217 217
                     'InstallWarningHeader',
218
-                    '<div class="alert alert-warning">' . _t(
218
+                    '<div class="alert alert-warning">'._t(
219 219
                         'SilverStripe\\CMS\\Model\\SiteTree.REMOVE_INSTALL_WARNING',
220 220
                         'Warning: You should remove install.php from this SilverStripe install for security reasons.'
221
-                    ) . '</div>'
221
+                    ).'</div>'
222 222
                 ),
223 223
                 'Title'
224 224
             );
225 225
         }
226 226
 
227
-        $tabMain->setTitle(_t(self::class . '.TABMAIN', "Main"));
228
-        $tabAccess->setTitle(_t(self::class . '.TABACCESS', "Access"));
227
+        $tabMain->setTitle(_t(self::class.'.TABMAIN', "Main"));
228
+        $tabAccess->setTitle(_t(self::class.'.TABACCESS', "Access"));
229 229
         $this->extend('updateCMSFields', $fields);
230 230
 
231 231
         return $fields;
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
     {
433 433
         return [
434 434
             'EDIT_SITECONFIG' => [
435
-                'name' => _t(self::class . '.EDIT_PERMISSION', 'Manage site configuration'),
435
+                'name' => _t(self::class.'.EDIT_PERMISSION', 'Manage site configuration'),
436 436
                 'category' => _t(
437 437
                     'SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY',
438 438
                     'Roles and access permissions'
439 439
                 ),
440 440
                 'help' => _t(
441
-                    self::class . '.EDIT_PERMISSION_HELP',
441
+                    self::class.'.EDIT_PERMISSION_HELP',
442 442
                     'Ability to edit global access settings/top-level page permissions.'
443 443
                 ),
444 444
                 'sort' => 400
Please login to merge, or discard this patch.