No Description

NullSessionHandler.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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\Handler;
  11. /**
  12. * Can be used in unit testing or in a situations where persisted sessions are not desired.
  13. *
  14. * @author Drak <drak@zikula.org>
  15. */
  16. class NullSessionHandler extends AbstractSessionHandler
  17. {
  18. /**
  19. * @return bool
  20. */
  21. #[\ReturnTypeWillChange]
  22. public function close()
  23. {
  24. return true;
  25. }
  26. /**
  27. * @return bool
  28. */
  29. #[\ReturnTypeWillChange]
  30. public function validateId($sessionId)
  31. {
  32. return true;
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. protected function doRead($sessionId)
  38. {
  39. return '';
  40. }
  41. /**
  42. * @return bool
  43. */
  44. #[\ReturnTypeWillChange]
  45. public function updateTimestamp($sessionId, $data)
  46. {
  47. return true;
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. protected function doWrite($sessionId, $data)
  53. {
  54. return true;
  55. }
  56. /**
  57. * {@inheritdoc}
  58. */
  59. protected function doDestroy($sessionId)
  60. {
  61. return true;
  62. }
  63. /**
  64. * @return int|false
  65. */
  66. #[\ReturnTypeWillChange]
  67. public function gc($maxlifetime)
  68. {
  69. return 0;
  70. }
  71. }