| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | trait ContainerCookieTrait |
||
| 18 | { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param string $key |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | public function getCookie(string $key): string |
||
| 25 | { |
||
| 26 | return $_COOKIE[$key]; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param string $key |
||
| 31 | * @return bool |
||
| 32 | */ |
||
| 33 | public function hasCookie(string $key): bool |
||
| 34 | { |
||
| 35 | return isset($_COOKIE[$key]); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @codeCoverageIgnore |
||
| 40 | * @param string $key |
||
| 41 | */ |
||
| 42 | public function unsetCookie(string $key): void |
||
| 43 | { |
||
| 44 | unset($_COOKIE[$key]); |
||
| 45 | setcookie($key, '', -1, '/'); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $key |
||
| 50 | * @param string $value |
||
| 51 | */ |
||
| 52 | public function setCookie(string $key, string $value): void |
||
| 55 | } |
||
| 56 | } |
||
| 57 |