Skip to content

Commit b27b1b7

Browse files
authored
Merge pull request #12 from josantonius/release/v2.0.6
Release/v2.0.6
2 parents 278c002 + 4fa9a84 commit b27b1b7

15 files changed

+151
-122
lines changed

.github/lang/es-ES/README.md

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ Biblioteca PHP para el manejo de cookies.
3434

3535
## Requisitos
3636

37-
Esta biblioteca es compatible con las versiones de PHP: 8.1.
37+
- Sistema operativo: Linux.
38+
39+
- Versiones de PHP: 8.1 | 8.2.
3840

3941
## Instalación
4042

@@ -63,9 +65,7 @@ git clone https://github.com/josantonius/php-cookie.git
6365

6466
### Clase Cookie
6567

66-
```php
67-
use Josantonius\Cookie\Cookie;
68-
```
68+
`Josantonius\Cookie\Cookie`
6969

7070
Establece las opciones de las cookies:
7171

@@ -88,15 +88,14 @@ Establece las opciones de las cookies:
8888
* @see https://www.php.net/manual/en/datetime.formats.php for date formats.
8989
* @see https://www.php.net/manual/en/function.setcookie.php for more information.
9090
*/
91-
92-
$cookie = new Cookie(
93-
string $domain = '',
94-
int|string|DateTime $expires = 0,
95-
bool $httpOnly = false,
96-
string $path = '/',
97-
bool $raw = false,
98-
null|string $sameSite = null,
99-
bool $secure = false
91+
public function __construct(
92+
private string $domain = '',
93+
private int|string|DateTime $expires = 0,
94+
private bool $httpOnly = false,
95+
private string $path = '/',
96+
private bool $raw = false,
97+
private null|string $sameSite = null,
98+
private bool $secure = false
10099
);
101100
```
102101

@@ -107,11 +106,11 @@ Establece una cookie por nombre:
107106
* @throws CookieException si las cabeceras ya han sido enviadas.
108107
* @throws CookieException si falla el análisis de la cadena de fecha/hora.
109108
*/
110-
$cookie->set(
109+
public function set(
111110
string $name,
112111
mixed $value,
113112
null|int|string|DateTime $expires = null
114-
): void
113+
): void;
115114
```
116115

117116
Establece varias cookies a la vez:
@@ -122,10 +121,10 @@ Establece varias cookies a la vez:
122121
*
123122
* @throws CookieException si las cabeceras ya han sido enviadas.
124123
*/
125-
$cookie->replace(
124+
public function replace(
126125
array $data,
127126
null|int|string|DateTime $expires = null
128-
): void
127+
): void;
129128
```
130129

131130
Obtiene una cookie por su nombre:
@@ -134,19 +133,19 @@ Obtiene una cookie por su nombre:
134133
/**
135134
* Opcionalmente define un valor por defecto cuando la cookie no existe.
136135
*/
137-
$cookie->get(string $name, mixed $default = null): mixed
136+
public function get(string $name, mixed $default = null): mixed;
138137
```
139138

140139
Obtiene todas las cookies:
141140

142141
```php
143-
$cookie->all(): array
142+
public function all(): array;
144143
```
145144

146145
Comprueba si existe una cookie:
147146

148147
```php
149-
$cookie->has(string $name): bool
148+
public function has(string $name): bool;
150149
```
151150

152151
Elimina una cookie por su nombre y devuelve su valor:
@@ -157,7 +156,7 @@ Elimina una cookie por su nombre y devuelve su valor:
157156
*
158157
* @throws CookieException si las cabeceras ya han sido enviadas.
159158
*/
160-
$cookie->pull(string $name, mixed $default = null): mixed
159+
public function pull(string $name, mixed $default = null): mixed;
161160
```
162161

163162
Borra una cookie por su nombre:
@@ -167,14 +166,12 @@ Borra una cookie por su nombre:
167166
* @throws CookieException si las cabeceras ya han sido enviadas.
168167
* @throws CookieException si falla el análisis de la cadena de fecha/hora.
169168
*/
170-
$cookie->remove(string $name): void
169+
public function remove(string $name): void;
171170
```
172171

173172
### Fachada Cookie
174173

175-
```php
176-
use Josantonius\Cookie\Facades\Cookie;
177-
```
174+
`Josantonius\Cookie\Facades\Cookie`
178175

179176
Establece las opciones de las cookies:
180177

@@ -197,16 +194,15 @@ Establece las opciones de las cookies:
197194
* @see https://www.php.net/manual/en/datetime.formats.php for date formats.
198195
* @see https://www.php.net/manual/en/function.setcookie.php for more information.
199196
*/
200-
201-
Cookie::options(
197+
public static function options(
202198
string $domain = '',
203199
int|string|DateTime $expires = 0,
204200
bool $httpOnly = false,
205201
string $path = '/',
206202
bool $raw = false,
207203
null|string $sameSite = null,
208204
bool $secure = false
209-
);
205+
): void;
210206
```
211207

212208
Establece una cookie por nombre:
@@ -216,11 +212,11 @@ Establece una cookie por nombre:
216212
* @throws CookieException si las cabeceras ya han sido enviadas.
217213
* @throws CookieException si falla el análisis de la cadena de fecha/hora.
218214
*/
219-
Cookie::set(
215+
public static function set(
220216
string $name,
221217
mixed $value,
222218
null|int|string|DateTime $expires = null
223-
): void
219+
): void;
224220
```
225221

226222
Establece varias cookies a la vez:
@@ -231,10 +227,10 @@ Establece varias cookies a la vez:
231227
*
232228
* @throws CookieException si las cabeceras ya han sido enviadas.
233229
*/
234-
Cookie::replace(
230+
public static function replace(
235231
array $data,
236232
null|int|string|DateTime $expires = null
237-
): void
233+
): void;
238234
```
239235

240236
Obtiene una cookie por su nombre:
@@ -243,19 +239,19 @@ Obtiene una cookie por su nombre:
243239
/**
244240
* Opcionalmente define un valor por defecto cuando la cookie no existe.
245241
*/
246-
Cookie::get(string $name, mixed $default = null): mixed
242+
public static function get(string $name, mixed $default = null): mixed;
247243
```
248244

249245
Obtiene todas las cookies:
250246

251247
```php
252-
Cookie::all(): array
248+
public static function all(): array;
253249
```
254250

255251
Comprueba si existe una cookie:
256252

257253
```php
258-
Cookie::has(string $name): bool
254+
public static function has(string $name): bool;
259255
```
260256

261257
Elimina una cookie por su nombre y devuelve su valor:
@@ -266,7 +262,7 @@ Elimina una cookie por su nombre y devuelve su valor:
266262
*
267263
* @throws CookieException si las cabeceras ya han sido enviadas.
268264
*/
269-
Cookie::pull(string $name, mixed $default = null): mixed
265+
public static function pull(string $name, mixed $default = null): mixed;
270266
```
271267

272268
Borra una cookie por su nombre:
@@ -276,7 +272,7 @@ Borra una cookie por su nombre:
276272
* @throws CookieException si las cabeceras ya han sido enviadas.
277273
* @throws CookieException si falla el análisis de la cadena de fecha/hora.
278274
*/
279-
Cookie::remove(string $name): void
275+
public static function remove(string $name): void;
280276
```
281277

282278
## Excepciones utilizadas
@@ -285,7 +281,7 @@ Cookie::remove(string $name): void
285281
use Josantonius\Cookie\Exceptions\CookieException;
286282
```
287283

288-
## Usage
284+
## Uso
289285

290286
Ejemplos de uso de esta biblioteca:
291287

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
system: ['ubuntu-latest']
4747
php:
4848
- '8.1'
49+
- '8.2'
4950
steps:
5051
- name: Checkout Code
5152
uses: actions/checkout@v3

CHANGELOG.md

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

3+
## [v2.0.6](https://github.com/josantonius/php-cookie/releases/tag/v2.0.6) (2022-09-29)
4+
5+
* The notation type in the test function names has been changed from camel to snake case for readability.
6+
7+
* Functions were added to document the methods and avoid confusion.
8+
9+
* Disabled the ´CamelCaseMethodName´ rule in ´phpmd.xml´ to avoid warnings about function names in tests.
10+
11+
* The alignment of the asterisks in the comments has been fixed.
12+
13+
* Tests for Windows have been added.
14+
15+
* Tests for PHP 8.2 have been added.
16+
317
## [2.0.5](https://github.com/josantonius/php-cookie/releases/tag/2.0.5) (2022-08-11)
418

519
* Improved documentation.

0 commit comments

Comments
 (0)