NullSessionHandler.php 1.2 KB

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