| 1 | <?php | ||
| 19 | class SessionCookieJar extends AbstractPersistentCookieJar | ||
| 20 | { | ||
| 21 | /** | ||
| 22 | * @var string | ||
| 23 | */ | ||
| 24 | private $key; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * @param string $key | ||
| 28 | * @param CookieFactoryInterface|null $cookieFactory | ||
| 29 | */ | ||
| 30 | 63 | public function __construct($key, CookieFactoryInterface $cookieFactory = null) | |
| 36 | |||
| 37 | /** | ||
| 38 | * @return string | ||
| 39 | */ | ||
| 40 | 18 | public function getKey() | |
| 44 | |||
| 45 | /** | ||
| 46 | * @param string $key | ||
| 47 | */ | ||
| 48 | 63 | public function setKey($key) | |
| 52 | |||
| 53 | /** | ||
| 54 |      * {@inheritdoc} | ||
| 55 | */ | ||
| 56 | 63 | public function load() | |
| 60 | |||
| 61 | /** | ||
| 62 |      * {@inheritdoc} | ||
| 63 | */ | ||
| 64 | 36 | public function save() | |
| 68 | } | ||
| 69 | 
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: