12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Framework\Stdlib;
- use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
- use Magento\Framework\Stdlib\Cookie\PublicCookieMetadata;
- use Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata;
- use Magento\Framework\Stdlib\Cookie\FailureToSendException;
- use Magento\Framework\Stdlib\Cookie\CookieSizeLimitReachedException;
- use Magento\Framework\Stdlib\Cookie\CookieMetadata;
- use Magento\Framework\Exception\InputException;
- /**
- * CookieManager helps manage the setting, retrieving and deleting of cookies.
- *
- * The cookie manager will make it possible for an application to indicate if a cookie contains sensitive data,
- * this will allow extra protection to be added to the contents of the cookie as well sending directives to the browser
- * about how the cookie should be stored and whether JavaScript can access the cookie.
- *
- * @api
- * @since 100.0.2
- */
- interface CookieManagerInterface extends CookieReaderInterface
- {
- /**
- * Set a value in a private cookie with the given $name $value pairing.
- *
- * Sensitive cookies cannot be accessed by JS. HttpOnly will always be set to true for these cookies.
- *
- * @param string $name
- * @param string $value
- * @param SensitiveCookieMetadata $metadata
- * @return void
- * @throws FailureToSendException Cookie couldn't be sent to the browser. If this exception isn't thrown,
- * there is still no guarantee that the browser received and accepted the cookie.
- * @throws CookieSizeLimitReachedException Thrown when the cookie is too big to store any additional data.
- * @throws InputException If the cookie name is empty or contains invalid characters.
- */
- public function setSensitiveCookie($name, $value, SensitiveCookieMetadata $metadata = null);
- /**
- * Set a value in a public cookie with the given $name $value pairing.
- *
- * Public cookies can be accessed by JS. HttpOnly will be set to false by default for these cookies,
- * but can be changed to true.
- *
- * @param string $name
- * @param string $value
- * @param PublicCookieMetadata $metadata
- * @return void
- * @throws FailureToSendException If cookie couldn't be sent to the browser.
- * @throws CookieSizeLimitReachedException Thrown when the cookie is too big to store any additional data.
- * @throws InputException If the cookie name is empty or contains invalid characters.
- */
- public function setPublicCookie($name, $value, PublicCookieMetadata $metadata = null);
- /**
- * Deletes a cookie with the given name.
- *
- * @param string $name
- * @param CookieMetadata $metadata
- * @return void
- * @throws FailureToSendException If cookie couldn't be sent to the browser.
- * If this exception isn't thrown, there is still no guarantee that the browser
- * received and accepted the request to delete this cookie.
- * @throws InputException If the cookie name is empty or contains invalid characters.
- */
- public function deleteCookie($name, CookieMetadata $metadata = null);
- }
|