12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace Symfony\Component\HttpFoundation\Session\Storage;
- use Symfony\Component\HttpFoundation\Request;
- class_exists(NativeSessionStorage::class);
- class NativeSessionStorageFactory implements SessionStorageFactoryInterface
- {
- private $options;
- private $handler;
- private $metaBag;
- private $secure;
-
- public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null, bool $secure = false)
- {
- $this->options = $options;
- $this->handler = $handler;
- $this->metaBag = $metaBag;
- $this->secure = $secure;
- }
- public function createStorage(?Request $request): SessionStorageInterface
- {
- $storage = new NativeSessionStorage($this->options, $this->handler, $this->metaBag);
- if ($this->secure && $request && $request->isSecure()) {
- $storage->setOptions(['cookie_secure' => true]);
- }
- return $storage;
- }
- }
|