Skip to content

Commit 998a8b3

Browse files
committed
The version was added in the methods
1 parent 369b02e commit 998a8b3

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/Cookie.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ class Cookie {
2626

2727
/**
2828
* Prefix for cookies.
29-
*
29+
*
30+
* @since 1.0.0
31+
*
3032
* @var string
3133
*/
3234
private static $_prefix = 'jst_';
3335

3436
/**
3537
* Set cookie.
3638
*
39+
* @since 1.0.0
40+
*
3741
* @param string $key → name the data to save
3842
* @param string $value → the data to save
3943
* @param string $time → expiration time in days
@@ -46,6 +50,8 @@ public static function set(string $key, string $value, string $time = 365) {
4650
/**
4751
* Extract item from cookie then delete from the cookie and return the item.
4852
*
53+
* @since 1.0.0
54+
*
4955
* @param string $key → item to extract
5056
*
5157
* @return string|null → return item or null when key does not exists
@@ -65,6 +71,8 @@ public static function pull(string $key) {
6571
/**
6672
* Get item from cookie.
6773
*
74+
* @since 1.0.0
75+
*
6876
* @param string $key → item to look for in cookie
6977
*
7078
* @return string|null → returns the key value, or null if key doesn't exists
@@ -74,10 +82,11 @@ public static function get(string $key) {
7482
return $_COOKIE[self::$_prefix . $key] ?? null;
7583
}
7684

77-
7885
/**
7986
* Return cookies array.
8087
*
88+
* @since 1.0.0
89+
*
8190
* @return array|null → of cookie indexes
8291
*/
8392
public static function display() {
@@ -86,10 +95,11 @@ public static function display() {
8695

8796
}
8897

89-
9098
/**
9199
* Empties and destroys the cookies.
92100
*
101+
* @since 1.0.0
102+
*
93103
* @param string $key → cookie name to destroy. Not set to delete all
94104
*/
95105
public static function destroy(string $key = '') {
@@ -109,4 +119,4 @@ public static function destroy(string $key = '') {
109119
}
110120
}
111121
}
112-
}
122+
}

tests/CookieTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class CookieTest {
2626

2727
/**
2828
* Set cookie.
29+
*
30+
* @since 1.0.0
2931
*/
3032
public static function testSetCookie() {
3133

@@ -35,6 +37,8 @@ public static function testSetCookie() {
3537
/**
3638
* Extract item from cookie then delete from the cookie and return the item.
3739
*
40+
* @since 1.0.0
41+
*
3842
* @return mixed|null → return item or null when key does not exists
3943
*/
4044
public static function testPullCookie() {
@@ -45,27 +49,31 @@ public static function testPullCookie() {
4549
/**
4650
* Get item from cookie.
4751
*
52+
* @since 1.0.0
53+
*
4854
* @return mixed|null → returns the key value, or null if key doesn't exists
4955
*/
5056
public static function testGetCookie($key) {
5157

5258
return Cookie::get('CookieName');
5359
}
5460

55-
5661
/**
5762
* Return cookies array.
5863
*
64+
* @since 1.0.0
65+
*
5966
* @return array|null → of cookie indexes
6067
*/
6168
public static function testDisplayCookies() {
6269

6370
return Cookie::display();
6471
}
6572

66-
6773
/**
6874
* Destroy one cookie.
75+
*
76+
* @since 1.0.0
6977
*/
7078
public static function testDestroyOneCookie() {
7179

@@ -74,6 +82,8 @@ public static function testDestroyOneCookie() {
7482

7583
/**
7684
* Destroy all cookies.
85+
*
86+
* @since 1.0.0
7787
*/
7888
public static function testDestroyAllCookies() {
7989

0 commit comments

Comments
 (0)