1 | <?php |
||
12 | class SubsiteState |
||
13 | { |
||
14 | use Injectable; |
||
15 | |||
16 | /** |
||
17 | * @var int|null |
||
18 | */ |
||
19 | protected $subsiteId; |
||
20 | |||
21 | /** |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $useSessions; |
||
25 | |||
26 | /** |
||
27 | * Get the current subsite ID |
||
28 | * |
||
29 | * @return int|null |
||
30 | */ |
||
31 | public function getSubsiteId() |
||
35 | |||
36 | /** |
||
37 | * Set the current subsite ID |
||
38 | * |
||
39 | * @param int $id |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function setSubsiteId($id) |
||
56 | |||
57 | /** |
||
58 | * Get whether to use sessions for storing the subsite ID |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function getUseSessions() |
||
66 | |||
67 | /** |
||
68 | * Set whether to use sessions for storing the subsite ID |
||
69 | * |
||
70 | * @param bool $useSessions |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function setUseSessions($useSessions) |
||
78 | |||
79 | /** |
||
80 | * Perform a given action within the context of a new, isolated state. Modifications are temporary |
||
81 | * and the existing state will be restored afterwards. |
||
82 | * |
||
83 | * @param callable $callback Callback to run. Will be passed the nested state as a parameter |
||
84 | * @return mixed Result of callback |
||
85 | */ |
||
86 | public function withState(callable $callback) |
||
96 | } |
||
97 |