| Total Complexity | 7 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 84.62% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class UCookie { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Sends a cookie |
||
| 18 | * |
||
| 19 | * @param string $name |
||
| 20 | * the name of the cookie |
||
| 21 | * @param string $value |
||
| 22 | * The value of the cookie. |
||
| 23 | * @param int $duration |
||
| 24 | * default : 1 day |
||
| 25 | * @param string $path |
||
| 26 | * default : / the cookie will be available within the entire domain |
||
| 27 | */ |
||
| 28 | 1 | public static function set($name, $value, $duration = 60*60*24, $path = "/") { |
|
| 29 | 1 | \setcookie ( $name, $value, \time () + $duration, $path ); |
|
| 30 | 1 | } |
|
| 31 | |||
| 32 | /** |
||
| 33 | * Returns the Cookie with the name $name |
||
| 34 | * |
||
| 35 | * @param string $name |
||
| 36 | * @param string $default |
||
| 37 | * @return null|string |
||
| 38 | */ |
||
| 39 | 2 | public static function get($name, $default = null) { |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Removes the cookie with the name $name |
||
| 45 | * |
||
| 46 | * @param string $name |
||
| 47 | * @param string $path |
||
| 48 | */ |
||
| 49 | 1 | public static function delete($name, $path = "/") { |
|
| 50 | 1 | if (isset ( $_COOKIE [$name] )) { |
|
| 51 | unset ( $_COOKIE [$name] ); |
||
| 52 | } |
||
| 53 | 1 | \setcookie ( $name, "", \time () - 3600, $path ); |
|
| 54 | 1 | } |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Deletes all cookies |
||
| 58 | */ |
||
| 59 | 1 | public static function deleteAll($path = "/") { |
|
| 62 | } |
||
| 63 | 1 | } |
|
| 64 | } |
||
| 65 |