|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * CodeIgniter |
| 5 | + * |
| 6 | + * An open source application development framework for PHP |
| 7 | + * |
| 8 | + * This content is released under the MIT License (MIT) |
| 9 | + * |
| 10 | + * Copyright (c) 2014-2019 British Columbia Institute of Technology |
| 11 | + * |
| 12 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 13 | + * of this software and associated documentation files (the "Software"), to deal |
| 14 | + * in the Software without restriction, including without limitation the rights |
| 15 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 16 | + * copies of the Software, and to permit persons to whom the Software is |
| 17 | + * furnished to do so, subject to the following conditions: |
| 18 | + * |
| 19 | + * The above copyright notice and this permission notice shall be included in |
| 20 | + * all copies or substantial portions of the Software. |
| 21 | + * |
| 22 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 23 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 24 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 25 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 26 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 27 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 28 | + * THE SOFTWARE. |
| 29 | + * |
| 30 | + * @package CodeIgniter |
| 31 | + * @author CodeIgniter Dev Team |
| 32 | + * @copyright 2014-2019 British Columbia Institute of Technology (https://bcit.ca/) |
| 33 | + * @license https://opensource.org/licenses/MIT MIT License |
| 34 | + * @link https://codeigniter.com |
| 35 | + * @since Version 4.0.0 |
| 36 | + * @filesource |
| 37 | + */ |
| 38 | + |
| 39 | +namespace CodeIgniter\Session\Handlers; |
| 40 | + |
| 41 | +use CodeIgniter\Session\Exceptions\SessionException; |
| 42 | +use CodeIgniter\Config\BaseConfig; |
| 43 | +use CodeIgniter\Database\BaseConnection; |
| 44 | +use Config\Database; |
| 45 | + |
| 46 | +/** |
| 47 | + * Session handler using static array for storage. |
| 48 | + * Intended only for use during testing. |
| 49 | + */ |
| 50 | +class ArrayHandler extends BaseHandler implements \SessionHandlerInterface |
| 51 | +{ |
| 52 | + protected static $cache = []; |
| 53 | + |
| 54 | + //-------------------------------------------------------------------- |
| 55 | + |
| 56 | + /** |
| 57 | + * Open |
| 58 | + * |
| 59 | + * Ensures we have an initialized database connection. |
| 60 | + * |
| 61 | + * @param string $savePath Path to session files' directory |
| 62 | + * @param string $name Session cookie name |
| 63 | + * |
| 64 | + * @return boolean |
| 65 | + * @throws \Exception |
| 66 | + */ |
| 67 | + public function open($savePath, $name): bool |
| 68 | + { |
| 69 | + return true; |
| 70 | + } |
| 71 | + |
| 72 | + //-------------------------------------------------------------------- |
| 73 | + |
| 74 | + /** |
| 75 | + * Read |
| 76 | + * |
| 77 | + * Reads session data and acquires a lock |
| 78 | + * |
| 79 | + * @param string $sessionID Session ID |
| 80 | + * |
| 81 | + * @return string Serialized session data |
| 82 | + */ |
| 83 | + public function read($sessionID): string |
| 84 | + { |
| 85 | + return ''; |
| 86 | + } |
| 87 | + |
| 88 | + //-------------------------------------------------------------------- |
| 89 | + |
| 90 | + /** |
| 91 | + * Write |
| 92 | + * |
| 93 | + * Writes (create / update) session data |
| 94 | + * |
| 95 | + * @param string $sessionID Session ID |
| 96 | + * @param string $sessionData Serialized session data |
| 97 | + * |
| 98 | + * @return boolean |
| 99 | + */ |
| 100 | + public function write($sessionID, $sessionData): bool |
| 101 | + { |
| 102 | + return true; |
| 103 | + } |
| 104 | + |
| 105 | + //-------------------------------------------------------------------- |
| 106 | + |
| 107 | + /** |
| 108 | + * Close |
| 109 | + * |
| 110 | + * Releases locks and closes file descriptor. |
| 111 | + * |
| 112 | + * @return boolean |
| 113 | + */ |
| 114 | + public function close(): bool |
| 115 | + { |
| 116 | + return true; |
| 117 | + } |
| 118 | + |
| 119 | + //-------------------------------------------------------------------- |
| 120 | + |
| 121 | + /** |
| 122 | + * Destroy |
| 123 | + * |
| 124 | + * Destroys the current session. |
| 125 | + * |
| 126 | + * @param string $sessionID |
| 127 | + * |
| 128 | + * @return boolean |
| 129 | + */ |
| 130 | + public function destroy($sessionID): bool |
| 131 | + { |
| 132 | + return true; |
| 133 | + } |
| 134 | + |
| 135 | + //-------------------------------------------------------------------- |
| 136 | + |
| 137 | + /** |
| 138 | + * Garbage Collector |
| 139 | + * |
| 140 | + * Deletes expired sessions |
| 141 | + * |
| 142 | + * @param integer $maxlifetime Maximum lifetime of sessions |
| 143 | + * |
| 144 | + * @return boolean |
| 145 | + */ |
| 146 | + public function gc($maxlifetime): bool |
| 147 | + { |
| 148 | + return true; |
| 149 | + } |
| 150 | + |
| 151 | + //-------------------------------------------------------------------- |
| 152 | +} |
0 commit comments