NullSessionHandler.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. * NullSessionHandler.
  13. *
  14. * Can be used in unit testing or in a situations where persisted sessions are not desired.
  15. *
  16. * @author Drak <drak@zikula.org>
  17. */
  18. class NullSessionHandler implements \SessionHandlerInterface
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function open($savePath, $sessionName)
  24. {
  25. return true;
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function close()
  31. {
  32. return true;
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function read($sessionId)
  38. {
  39. return '';
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function write($sessionId, $data)
  45. {
  46. return true;
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function destroy($sessionId)
  52. {
  53. return true;
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. public function gc($maxlifetime)
  59. {
  60. return true;
  61. }
  62. }