/ManaPHP/Http/Cookie.php

https://gitlab.com/szlongshu/manaphp · PHP · 251 lines · 90 code · 34 blank · 127 comment · 0 complexity · 651b26d4a0683f89bfb7ad3907988592 MD5 · raw file

  1. <?php
  2. namespace ManaPHP\Http {
  3. use ManaPHP\Component;
  4. /**
  5. * ManaPHP\Http\Cookie
  6. *
  7. * Provide OO wrappers to manage a HTTP cookie
  8. */
  9. class Cookie extends Component
  10. {
  11. protected $_hasRead;
  12. protected $_restored;
  13. protected $_useEncryption;
  14. protected $_filter;
  15. /**
  16. * @var string
  17. */
  18. protected $_name;
  19. protected $_value;
  20. protected $_expire;
  21. protected $_path;
  22. protected $_domain;
  23. protected $_secure;
  24. protected $_httpOnly;
  25. /**
  26. * \ManaPHP\Http\Cookie constructor
  27. *
  28. * @param string $name
  29. * @param mixed $value
  30. * @param int $expire
  31. * @param string $path
  32. * @param boolean $secure
  33. * @param string $domain
  34. * @param boolean $httpOnly
  35. */
  36. public function __construct(
  37. $name,
  38. $value = null,
  39. $expire = null,
  40. $path = null,
  41. $secure = null,
  42. $domain = null,
  43. $httpOnly = null
  44. ) {
  45. $this->_name = $name;
  46. $this->_value = $value;
  47. $this->_expire = $expire;
  48. $this->_path = $path;
  49. $this->_secure = $secure;
  50. $this->_domain = $domain;
  51. $this->_httpOnly = $httpOnly;
  52. }
  53. /**
  54. * Sets the cookie's value
  55. *
  56. * @param string $value
  57. *
  58. * @return \ManaPHP\Http\Cookie
  59. */
  60. public function setValue($value)
  61. {
  62. $this->_value = $value;
  63. }
  64. /**
  65. * Returns the cookie's value
  66. *
  67. * @param string|array $filters
  68. * @param string $defaultValue
  69. *
  70. * @return mixed
  71. */
  72. public function getValue($filters = null, $defaultValue = null)
  73. {
  74. }
  75. /**
  76. * Sends the cookie to the HTTP client
  77. * Stores the cookie definition in session
  78. *
  79. * @return static
  80. */
  81. public function send()
  82. {
  83. }
  84. /**
  85. * Reads the cookie-related info from the SESSION to restore the cookie as it was set
  86. * This method is automatically called internally so normally you don't need to call it
  87. *
  88. * @return static
  89. */
  90. public function restore()
  91. {
  92. }
  93. /**
  94. * Deletes the cookie by setting an expire time in the past
  95. *
  96. */
  97. public function delete()
  98. {
  99. }
  100. /**
  101. * Sets if the cookie must be encrypted/decrypted automatically
  102. *
  103. * @param boolean $useEncryption
  104. *
  105. * @return static
  106. */
  107. public function useEncryption($useEncryption)
  108. {
  109. }
  110. /**
  111. * Check if the cookie is using implicit encryption
  112. *
  113. * @return boolean
  114. */
  115. public function isUsingEncryption()
  116. {
  117. }
  118. /**
  119. * Sets the cookie's expiration time
  120. *
  121. * @param int $expire
  122. *
  123. * @return static
  124. */
  125. public function setExpiration($expire)
  126. {
  127. }
  128. /**
  129. * Returns the current expiration time
  130. *
  131. * @return string
  132. */
  133. public function getExpiration()
  134. {
  135. }
  136. /**
  137. * Sets the cookie's expiration time
  138. *
  139. * @param string $path
  140. *
  141. * @return static
  142. */
  143. public function setPath($path)
  144. {
  145. }
  146. /**
  147. * Returns the current cookie's path
  148. *
  149. * @return string
  150. */
  151. public function getPath()
  152. {
  153. }
  154. /**
  155. * Sets the domain that the cookie is available to
  156. *
  157. * @param string $domain
  158. *
  159. * @return static
  160. */
  161. public function setDomain($domain)
  162. {
  163. }
  164. /**
  165. * Returns the domain that the cookie is available to
  166. *
  167. * @return string
  168. */
  169. public function getDomain()
  170. {
  171. }
  172. /**
  173. * Sets if the cookie must only be sent when the connection is secure (HTTPS)
  174. *
  175. * @param boolean $secure
  176. *
  177. * @return static
  178. */
  179. public function setSecure($secure)
  180. {
  181. }
  182. /**
  183. * Returns whether the cookie must only be sent when the connection is secure (HTTPS)
  184. *
  185. * @return boolean
  186. */
  187. public function getSecure()
  188. {
  189. }
  190. /**
  191. * Sets if the cookie is accessible only through the HTTP protocol
  192. *
  193. * @param boolean $httpOnly
  194. *
  195. * @return static
  196. */
  197. public function setHttpOnly($httpOnly)
  198. {
  199. }
  200. /**
  201. * Returns if the cookie is accessible only through the HTTP protocol
  202. *
  203. * @return boolean
  204. */
  205. public function getHttpOnly()
  206. {
  207. }
  208. /**
  209. * Magic __toString method converts the cookie's value to string
  210. *
  211. * @return mixed
  212. */
  213. public function __toString()
  214. {
  215. }
  216. }
  217. }