Completed
Pull Request — master (#27)
by Will
01:23
created
src/Store/CookieStore.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use SilverStripe\Control\Cookie;
6 6
 use SilverStripe\HybridSessions\Crypto\CryptoHandler;
7
-use SilverStripe\Core\Config\Config;
8 7
 use SilverStripe\Core\Injector\Injector;
9 8
 
10 9
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
         // Verify expiration
113 113
         if ($cookieData) {
114
-            $expiry = (int)substr($cookieData, 0, 10);
114
+            $expiry = (int) substr($cookieData, 0, 10);
115 115
             $data = substr($cookieData, 10);
116 116
 
117 117
             if ($expiry > $this->getNow()) {
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 
149 149
         // Restore the known good cookie value
150 150
         $this->currentCookieData = $this->crypto->encrypt(
151
-            sprintf('%010u', $expiry) . $session_data
151
+            sprintf('%010u', $expiry).$session_data
152 152
         );
153 153
 
154 154
         // Respect auto-expire on browser close for the session cookie (in case the cookie lifetime is zero)
155
-        $cookieLifetime = min((int)$params['lifetime'], $lifetime);
155
+        $cookieLifetime = min((int) $params['lifetime'], $lifetime);
156 156
 
157 157
         Cookie::set(
158 158
             $this->cookie,
Please login to merge, or discard this patch.
src/Store/BaseStore.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
     protected function getLifetime()
46 46
     {
47 47
         $params = session_get_cookie_params();
48
-        $cookieLifetime = (int)$params['lifetime'];
49
-        $gcLifetime = (int)ini_get('session.gc_maxlifetime');
48
+        $cookieLifetime = (int) $params['lifetime'];
49
+        $gcLifetime = (int) ini_get('session.gc_maxlifetime');
50 50
 
51 51
         return $cookieLifetime ? min($cookieLifetime, $gcLifetime) : $gcLifetime;
52 52
     }
Please login to merge, or discard this patch.
src/Crypto/OpenSSLCrypto.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
         $ivlen = openssl_cipher_iv_length($cipher);
85 85
         $iv = substr($c, 0, $ivlen);
86 86
         $hmac = substr($c, $ivlen, $sha2len = 32);
87
-        $ciphertext_raw = substr($c, $ivlen+$sha2len);
87
+        $ciphertext_raw = substr($c, $ivlen + $sha2len);
88 88
         $cleartext = openssl_decrypt($ciphertext_raw, $cipher, $this->saltedKey, $options = OPENSSL_RAW_DATA, $iv);
89 89
         $calcmac = hash_hmac('sha256', $ciphertext_raw, $this->saltedKey, $as_binary = true);
90 90
 
Please login to merge, or discard this patch.