wip watten
This commit is contained in:
1 parent
8ace316cbf
commit
afc8a6e1f5
93 files changed
+14369
-1
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace HermannTelser\Watten\Utilities;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "mindshape Cookie Consent" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2021 Daniel Dorndorf <dorndorf@mindshape.de>, mindshape GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
/**
|
||||
* @package HermannTelser\Watten\Utility
|
||||
*/
|
||||
class CookieUtility
|
||||
{
|
||||
public const DEFAULT_COOKIE_NAME = 'watten';
|
||||
|
||||
/**
|
||||
|
||||
* @param string $name
|
||||
* @return array|null
|
||||
*/
|
||||
public static function getCookieValue(string $name = self::DEFAULT_COOKIE_NAME): ?array
|
||||
{
|
||||
if (false === self::hasCookie($name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode($_COOKIE[$name], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $named
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasCookie(string $name = self::DEFAULT_COOKIE_NAME): bool
|
||||
{
|
||||
return true === array_key_exists($name, $_COOKIE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public static function deleteCookie(string $name = self::DEFAULT_COOKIE_NAME): void
|
||||
{
|
||||
unset($_COOKIE[$name]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user