SessionManagerInterface.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /**
  3. * Magento session manager interface
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\Session;
  9. /**
  10. * Session Manager Interface
  11. *
  12. * @api
  13. * @since 100.0.2
  14. */
  15. interface SessionManagerInterface
  16. {
  17. /**
  18. * Session key for list of hosts
  19. */
  20. const HOST_KEY = '_session_hosts';
  21. /**
  22. * Start session
  23. *
  24. * @return SessionManagerInterface
  25. */
  26. public function start();
  27. /**
  28. * Session write close
  29. *
  30. * @return void
  31. */
  32. public function writeClose();
  33. /**
  34. * Does a session exist
  35. *
  36. * @return bool
  37. */
  38. public function isSessionExists();
  39. /**
  40. * Retrieve session Id
  41. *
  42. * @return string
  43. */
  44. public function getSessionId();
  45. /**
  46. * Retrieve session name
  47. *
  48. * @return string
  49. */
  50. public function getName();
  51. /**
  52. * Set session name
  53. *
  54. * @param string $name
  55. * @return SessionManagerInterface
  56. */
  57. public function setName($name);
  58. /**
  59. * Destroy/end a session
  60. *
  61. * @param array $options
  62. * @return void
  63. */
  64. public function destroy(array $options = null);
  65. /**
  66. * Unset session data
  67. *
  68. * @return $this
  69. */
  70. public function clearStorage();
  71. /**
  72. * Retrieve Cookie domain
  73. *
  74. * @return string
  75. */
  76. public function getCookieDomain();
  77. /**
  78. * Retrieve cookie path
  79. *
  80. * @return string
  81. */
  82. public function getCookiePath();
  83. /**
  84. * Retrieve cookie lifetime
  85. *
  86. * @return int
  87. */
  88. public function getCookieLifetime();
  89. /**
  90. * Specify session identifier
  91. *
  92. * @param string|null $sessionId
  93. * @return SessionManagerInterface
  94. */
  95. public function setSessionId($sessionId);
  96. /**
  97. * Renew session id and update session cookie
  98. *
  99. * @return SessionManagerInterface
  100. */
  101. public function regenerateId();
  102. /**
  103. * Expire the session cookie
  104. *
  105. * Sends a session cookie with no value, and with an expiry in the past.
  106. *
  107. * @return void
  108. */
  109. public function expireSessionCookie();
  110. /**
  111. * If session cookie is not applicable due to host or path mismatch - add session id to query
  112. *
  113. * @param string $urlHost
  114. * @return string
  115. */
  116. public function getSessionIdForHost($urlHost);
  117. /**
  118. * Check if session is valid for given hostname
  119. *
  120. * @param string $host
  121. * @return bool
  122. */
  123. public function isValidForHost($host);
  124. /**
  125. * Check if session is valid for given path
  126. *
  127. * @param string $path
  128. * @return bool
  129. */
  130. public function isValidForPath($path);
  131. }