| @@ 18-36 (lines=19) @@ | ||
| 15 | protected $parametersList = array('type'); |
|
| 16 | public static $container; |
|
| 17 | ||
| 18 | protected function init() |
|
| 19 | { |
|
| 20 | if (static::$container === null) { |
|
| 21 | switch ($this->type) { |
|
| 22 | case 'memcache': |
|
| 23 | static::$container = Suricate::CacheMemcache(true); |
|
| 24 | break; |
|
| 25 | case 'apc': |
|
| 26 | static::$container = Suricate::CacheApc(true); |
|
| 27 | break; |
|
| 28 | case 'file': |
|
| 29 | static::$container = Suricate::CacheFile(true); |
|
| 30 | break; |
|
| 31 | default: |
|
| 32 | throw new \Exception("Unknown cache type " . $this->type); |
|
| 33 | break; |
|
| 34 | } |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| 38 | public function getInstance() |
|
| 39 | { |
|
| @@ 12-30 (lines=19) @@ | ||
| 9 | private static $container; |
|
| 10 | ||
| 11 | ||
| 12 | protected function init() |
|
| 13 | { |
|
| 14 | if (self::$container === null) { |
|
| 15 | switch ($this->type) { |
|
| 16 | case 'native': |
|
| 17 | self::$container = Suricate::SessionNative(true); |
|
| 18 | break; |
|
| 19 | case 'cookie': |
|
| 20 | self::$container = Suricate::SessionCookie(true); |
|
| 21 | break; |
|
| 22 | case 'memcache': |
|
| 23 | self::$container = Suricate::SessionMemcache(true); |
|
| 24 | break; |
|
| 25 | default: |
|
| 26 | throw new Exception("Unknown session type " . $this->type); |
|
| 27 | break; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Get instance of session driver used |
|