MockFileSessionStorageFactory.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpFoundation\Session\Storage;
  11. use Symfony\Component\HttpFoundation\Request;
  12. // Help opcache.preload discover always-needed symbols
  13. class_exists(MockFileSessionStorage::class);
  14. /**
  15. * @author Jérémy Derussé <jeremy@derusse.com>
  16. */
  17. class MockFileSessionStorageFactory implements SessionStorageFactoryInterface
  18. {
  19. private $savePath;
  20. private $name;
  21. private $metaBag;
  22. /**
  23. * @see MockFileSessionStorage constructor.
  24. */
  25. public function __construct(?string $savePath = null, string $name = 'MOCKSESSID', ?MetadataBag $metaBag = null)
  26. {
  27. $this->savePath = $savePath;
  28. $this->name = $name;
  29. $this->metaBag = $metaBag;
  30. }
  31. public function createStorage(?Request $request): SessionStorageInterface
  32. {
  33. return new MockFileSessionStorage($this->savePath, $this->name, $this->metaBag);
  34. }
  35. }