1 | <?php |
||
11 | class SubsiteState |
||
12 | { |
||
13 | use Injectable; |
||
14 | |||
15 | /** |
||
16 | * @var int|null |
||
17 | */ |
||
18 | protected $subsiteId; |
||
19 | |||
20 | /** |
||
21 | * Get the current subsite ID |
||
22 | * |
||
23 | * @return int|null |
||
24 | */ |
||
25 | public function getSubsiteId() |
||
29 | |||
30 | /** |
||
31 | * Set the current subsite ID |
||
32 | * |
||
33 | * @param int $id |
||
34 | * @return $this |
||
35 | */ |
||
36 | public function setSubsiteId($id) |
||
42 | |||
43 | /** |
||
44 | * Perform a given action within the context of a new, isolated state. Modifications are temporary |
||
45 | * and the existing state will be restored afterwards. |
||
46 | * |
||
47 | * @param callable $callback Callback to run. Will be passed the nested state as a parameter |
||
48 | * @return mixed Result of callback |
||
49 | */ |
||
50 | public function withState(callable $callback) |
||
60 | } |
||
61 |