1 | <?php |
||
23 | final class Session extends Base |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @readwrite |
||
28 | * @var string FQ driver class name or alias |
||
29 | */ |
||
30 | protected $driver = 'server'; |
||
31 | |||
32 | /** |
||
33 | * @readwrite |
||
34 | * @var array Driver initialization options |
||
35 | */ |
||
36 | protected $options = []; |
||
37 | |||
38 | /** |
||
39 | * @var array List of known session drivers |
||
40 | */ |
||
41 | private static $knownDrivers = [ |
||
42 | 'server' => Server::class |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * Sets a custom driver class to session factory |
||
47 | * |
||
48 | * @param string $alias |
||
49 | * @param string $className |
||
50 | */ |
||
51 | 4 | public static function addClass($alias, $className) |
|
55 | |||
56 | /** |
||
57 | * Creates a session driver with provided options |
||
58 | * |
||
59 | * @param array $options |
||
60 | * @return SessionDriverInterface |
||
61 | */ |
||
62 | 6 | public static function create(array $options = []) |
|
67 | |||
68 | /** |
||
69 | * Creates the driver for current |
||
70 | * |
||
71 | * @return SessionDriverInterface |
||
72 | */ |
||
73 | 6 | public function getDriver() |
|
78 | |||
79 | /** |
||
80 | * Verifies and returns the FQ session driver class name |
||
81 | * |
||
82 | * @param string $alias |
||
83 | * @return string |
||
84 | */ |
||
85 | 6 | private function getClassName($alias) |
|
93 | |||
94 | /** |
||
95 | * Check if provided class exists and implements SessionDriverInterface |
||
96 | * |
||
97 | * @param string $className |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 6 | private static function checkClass($className) |
|
118 | } |