Passed
Push — 2.2 ( df6c66...52f601 )
by Myles
01:48
created
scwCookie/ajax.php 1 patch
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,34 +7,34 @@
 block discarded – undo
7 7
 }
8 8
 
9 9
 switch ($_POST['action']) {
10
-    case 'hide':
11
-        // Set cookie
12
-        ScwCookie\ScwCookie::setCookie('scwCookieHidden', 'true', 52, 'weeks');
13
-        header('Content-Type: application/json');
14
-        die(json_encode(['success' => true]));
15
-        break;
10
+        case 'hide':
11
+            // Set cookie
12
+            ScwCookie\ScwCookie::setCookie('scwCookieHidden', 'true', 52, 'weeks');
13
+            header('Content-Type: application/json');
14
+            die(json_encode(['success' => true]));
15
+            break;
16 16
 
17
-    case 'toggle':
18
-        // Update if cookie allowed or not
19
-        $choices = ScwCookie\ScwCookie::getCookie('scwCookie');
20
-        if ($choices == false) {
21
-            $choices = [];
22
-            $scwCookie = new ScwCookie\ScwCookie;
23
-            $enabledCookies = $scwCookie->enabledCookies();
24
-            foreach ($enabledCookies as $name => $label) {
25
-                $choices[$name] = $scwCookie->config['unsetDefault'];
17
+        case 'toggle':
18
+            // Update if cookie allowed or not
19
+            $choices = ScwCookie\ScwCookie::getCookie('scwCookie');
20
+            if ($choices == false) {
21
+                $choices = [];
22
+                $scwCookie = new ScwCookie\ScwCookie;
23
+                $enabledCookies = $scwCookie->enabledCookies();
24
+                foreach ($enabledCookies as $name => $label) {
25
+                    $choices[$name] = $scwCookie->config['unsetDefault'];
26
+                }
27
+                ScwCookie\ScwCookie::setCookie('scwCookie', ScwCookie\ScwCookie::encrypt($choices), 52, 'weeks');
28
+            } else {
29
+                $choices = ScwCookie\ScwCookie::decrypt($choices);
26 30
             }
27
-            ScwCookie\ScwCookie::setCookie('scwCookie', ScwCookie\ScwCookie::encrypt($choices), 52, 'weeks');
28
-        } else {
29
-            $choices = ScwCookie\ScwCookie::decrypt($choices);
30
-        }
31
-        $choices[$_POST['name']] = $_POST['value'] == 'true' ? 'allowed' : 'blocked';
32
-        $choices = ScwCookie\ScwCookie::encrypt($choices);
33
-        ScwCookie\ScwCookie::setCookie('scwCookie', $choices, 52, 'weeks');
34
-        break;
31
+            $choices[$_POST['name']] = $_POST['value'] == 'true' ? 'allowed' : 'blocked';
32
+            $choices = ScwCookie\ScwCookie::encrypt($choices);
33
+            ScwCookie\ScwCookie::setCookie('scwCookie', $choices, 52, 'weeks');
34
+            break;
35 35
 
36
-    default:
37
-        header('HTTP/1.0 403 Forbidden');
38
-        throw new Exception("Action not recognised");
39
-        break;
36
+        default:
37
+            header('HTTP/1.0 403 Forbidden');
38
+            throw new Exception("Action not recognised");
39
+            break;
40 40
 }
Please login to merge, or discard this patch.