Skip to content

Commit c999437

Browse files
committed
Repository version updated and the minimum required PHP version
1 parent 998a8b3 commit c999437

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 1.1.0 - 2017-01-30
4+
* Compatible with PHP 5.6 or higher.
5+
6+
## 1.0.0-v - 2017-01-30
7+
* Compatible only with PHP 7.0 or higher. In the next versions, the library will be modified to make it compatible with PHP 5.6 or higher.
8+
39
## 1.0.0 - 2016-12-15
410
* Added `Josantonius\Cookie\Cookie` class.
511
* Added `Josantonius\Cookie\Cookie::set()` method.

README-ES.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ Para instalar PHP Cookie library, simplemente escribe:
3232

3333
### Requisitos
3434

35-
Esta ĺibrería es soportada por versiones de PHP 7.0 o superiores y es compatible con versiones de HHVM 3.0 o superiores.
36-
37-
Para utilizar esta librería en HHVM (HipHop Virtual Machine) tendrás que activar los tipos escalares. Añade la siguiente ĺínea "hhvm.php7.scalar_types = true" en tu "/etc/hhvm/php.ini".
35+
Esta ĺibrería es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores.
3836

3937
### Cómo empezar y ejemplos
4038

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ To install PHP Cookie library, simply:
3232

3333
### Requirements
3434

35-
This library is supported by PHP versions 7.0 or higher and is compatible with HHVM versions 3.0 or higher.
36-
37-
To use this library in HHVM (HipHop Virtual Machine) you will have to activate the scalar types. Add the following line "hhvm.php7.scalar_types = true" in your "/etc/hhvm/php.ini".
35+
This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.
3836

3937
### Quick Start and Examples
4038

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "josantonius/cookie",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"type": "library",
55
"description": "PHP library for handling cookies.",
66
"keywords": [
@@ -20,7 +20,7 @@
2020
"minimum-stability": "dev",
2121
"prefer-stable" : true,
2222
"require": {
23-
"php" : ">=7.0"
23+
"php" : ">=5.6"
2424
},
2525
"autoload": {
2626
"psr-4": {
@@ -37,4 +37,4 @@
3737
"dev-master": "1.0-dev"
3838
}
3939
}
40-
}
40+
}

src/Cookie.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php declare(strict_types=1);
1+
<?php
22
/**
33
* PHP library for handling cookies.
44
*
@@ -8,9 +8,9 @@
88
* @author Josantonius - info@josantonius.com
99
* @copyright Copyright (c) 2016 JST PHP Framework
1010
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
11-
* @version 1.0.0
11+
* @version 1.1.0
1212
* @link https://github.com/Josantonius/PHP-Cookie
13-
* @since File available since 1.0.0 - Update: 2016-12-19
13+
* @since File available since 1.0.0 - Update: 2017-01-30
1414
*/
1515

1616
namespace Josantonius\Cookie;
@@ -42,7 +42,7 @@ class Cookie {
4242
* @param string $value → the data to save
4343
* @param string $time → expiration time in days
4444
*/
45-
public static function set(string $key, string $value, string $time = 365) {
45+
public static function set($key, $value, $time = 365) {
4646

4747
setcookie(self::$_prefix.$key, $value, time() + (86400 * $time), "/");
4848
}
@@ -56,7 +56,7 @@ public static function set(string $key, string $value, string $time = 365) {
5656
*
5757
* @return string|null → return item or null when key does not exists
5858
*/
59-
public static function pull(string $key) {
59+
public static function pull($key) {
6060

6161
if (isset($_COOKIE[self::$_prefix . $key])) {
6262

@@ -77,9 +77,11 @@ public static function pull(string $key) {
7777
*
7878
* @return string|null → returns the key value, or null if key doesn't exists
7979
*/
80-
public static function get(string $key) {
80+
public static function get($key) {
8181

82-
return $_COOKIE[self::$_prefix . $key] ?? null;
82+
$cookieName = self::$_prefix . $key];
83+
84+
return isset($_COOKIE[$cookieName]) ? $_COOKIE[$cookieName] : null;
8385
}
8486

8587
/**

src/Exception/CookieException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php declare(strict_types=1);
1+
<?php
22
/**
33
* PHP library for handling cookies.
44
*
@@ -8,9 +8,9 @@
88
* @author Josantonius - info@josantonius.com
99
* @copyright Copyright (c) 2016 JST PHP Framework
1010
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
11-
* @version 1.0.0
11+
* @version 1.1.0
1212
* @link https://github.com/Josantonius/PHP-Cookie
13-
* @since File available since 1.0.0 - Update: 2016-12-15
13+
* @since File available since 1.0.0 - Update: 2017-01-30
1414
*/
1515

1616
namespace Josantonius\Cookie\Exception;
@@ -35,7 +35,7 @@ class CookieException extends \Exception {
3535
* @param int $error → error code (Optional)
3636
* @param int $status → HTTP response status code (Optional)
3737
*/
38-
public function __construct(string $msg = '', int $error = 0, int $status = 0) {
38+
public function __construct($msg = '', $error = 0, $status = 0) {
3939

4040
$this->message = $msg;
4141
$this->code = $error;

tests/CookieTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* @author Josantonius - info@josantonius.com
99
* @copyright Copyright (c) 2016 JST PHP Framework
1010
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
11-
* @version 1.0.0
11+
* @version 1.1.0
1212
* @link https://github.com/Josantonius/PHP-Cookie
13-
* @since File available since 1.0.0 - Update: 2016-12-15
13+
* @since File available since 1.0.0 - Update: 2017-01-30
1414
*/
1515

1616
namespace Josantonius\Cookie\Tests;
@@ -89,4 +89,4 @@ public static function testDestroyAllCookies() {
8989

9090
Cookie::destroy();
9191
}
92-
}
92+
}

0 commit comments

Comments
 (0)