MockFileSessionStorageFactory.php 1011 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. /**
  20. * @see MockFileSessionStorage constructor.
  21. */
  22. public function __construct(
  23. private ?string $savePath = null,
  24. private string $name = 'MOCKSESSID',
  25. private ?MetadataBag $metaBag = null,
  26. ) {
  27. }
  28. public function createStorage(?Request $request): SessionStorageInterface
  29. {
  30. return new MockFileSessionStorage($this->savePath, $this->name, $this->metaBag);
  31. }
  32. }