| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | class Cookie implements IdentifierInterface |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * Get the current or new unique identifier. |
||
| 32 | * |
||
| 33 | * @return string The identifier |
||
| 34 | */ |
||
| 35 | public function get(): string |
||
| 36 | { |
||
| 37 | if (! empty($_COOKIE['cart_identifier'])) { |
||
| 38 | return $_COOKIE['cart_identifier']; |
||
| 39 | } |
||
| 40 | |||
| 41 | return $this->regenerate(); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Regenerate the identifier. |
||
| 46 | * |
||
| 47 | * @return string The identifier |
||
| 48 | */ |
||
| 49 | public function regenerate(): string |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Forget the identifier. |
||
| 60 | * |
||
| 61 | * @return void |
||
| 62 | */ |
||
| 63 | public function forget(): void |
||
| 68 |
If you suppress an error, we recommend checking for the error condition explicitly: