File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,12 @@ class SessionStorage implements PersistentStorageInterface
10
10
11
11
public function __construct ()
12
12
{
13
- if (session_status () !== PHP_SESSION_ACTIVE ) {
14
- throw new ShopifySdkException (
15
- "Sessions are not active. Please start one using session_start() "
16
- );
17
- }
13
+
18
14
}
19
15
20
16
public function get ($ key )
21
17
{
18
+ $ this ->assertSession ();
22
19
if (isset ($ _SESSION [$ this ->prefix . $ key ])) {
23
20
return $ _SESSION [$ this ->prefix . $ key ];
24
21
}
@@ -27,6 +24,16 @@ public function get($key)
27
24
28
25
public function set ($ key , $ value )
29
26
{
27
+ $ this ->assertSession ();
30
28
$ _SESSION [$ this ->prefix . $ key ] = $ value ;
31
29
}
30
+
31
+ public function assertSession ()
32
+ {
33
+ if (session_status () !== PHP_SESSION_ACTIVE ) {
34
+ throw new ShopifySdkException (
35
+ "Sessions are not active. Please start one using session_start() "
36
+ );
37
+ }
38
+ }
32
39
}
You can’t perform that action at this time.
0 commit comments