NullSessionHandler.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. * {@inheritdoc}
  20. */
  21. public function close()
  22. {
  23. return true;
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function validateId($sessionId)
  29. {
  30. return true;
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. protected function doRead($sessionId)
  36. {
  37. return '';
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function updateTimestamp($sessionId, $data)
  43. {
  44. return true;
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. protected function doWrite($sessionId, $data)
  50. {
  51. return true;
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. protected function doDestroy($sessionId)
  57. {
  58. return true;
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function gc($maxlifetime)
  64. {
  65. return true;
  66. }
  67. }