Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/lang/es-ES/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ $cookie->set(
string $name,
mixed $value,
null|int|string|DateTime $expires = null
): void
): void;
```

Establece varias cookies a la vez:
Expand All @@ -125,7 +125,7 @@ Establece varias cookies a la vez:
$cookie->replace(
array $data,
null|int|string|DateTime $expires = null
): void
): void;
```

Obtiene una cookie por su nombre:
Expand All @@ -134,19 +134,19 @@ Obtiene una cookie por su nombre:
/**
* Opcionalmente define un valor por defecto cuando la cookie no existe.
*/
$cookie->get(string $name, mixed $default = null): mixed
$cookie->get(string $name, mixed $default = null): mixed;
```

Obtiene todas las cookies:

```php
$cookie->all(): array
$cookie->all(): array;
```

Comprueba si existe una cookie:

```php
$cookie->has(string $name): bool
$cookie->has(string $name): bool;
```

Elimina una cookie por su nombre y devuelve su valor:
Expand All @@ -157,7 +157,7 @@ Elimina una cookie por su nombre y devuelve su valor:
*
* @throws CookieException si las cabeceras ya han sido enviadas.
*/
$cookie->pull(string $name, mixed $default = null): mixed
$cookie->pull(string $name, mixed $default = null): mixed;
```

Borra una cookie por su nombre:
Expand All @@ -167,7 +167,7 @@ Borra una cookie por su nombre:
* @throws CookieException si las cabeceras ya han sido enviadas.
* @throws CookieException si falla el análisis de la cadena de fecha/hora.
*/
$cookie->remove(string $name): void
$cookie->remove(string $name): void;
```

### Fachada Cookie
Expand Down Expand Up @@ -220,7 +220,7 @@ Cookie::set(
string $name,
mixed $value,
null|int|string|DateTime $expires = null
): void
): void;
```

Establece varias cookies a la vez:
Expand All @@ -234,7 +234,7 @@ Establece varias cookies a la vez:
Cookie::replace(
array $data,
null|int|string|DateTime $expires = null
): void
): void;
```

Obtiene una cookie por su nombre:
Expand All @@ -243,19 +243,19 @@ Obtiene una cookie por su nombre:
/**
* Opcionalmente define un valor por defecto cuando la cookie no existe.
*/
Cookie::get(string $name, mixed $default = null): mixed
Cookie::get(string $name, mixed $default = null): mixed;
```

Obtiene todas las cookies:

```php
Cookie::all(): array
Cookie::all(): array;
```

Comprueba si existe una cookie:

```php
Cookie::has(string $name): bool
Cookie::has(string $name): bool;
```

Elimina una cookie por su nombre y devuelve su valor:
Expand All @@ -266,7 +266,7 @@ Elimina una cookie por su nombre y devuelve su valor:
*
* @throws CookieException si las cabeceras ya han sido enviadas.
*/
Cookie::pull(string $name, mixed $default = null): mixed
Cookie::pull(string $name, mixed $default = null): mixed;
```

Borra una cookie por su nombre:
Expand All @@ -276,7 +276,7 @@ Borra una cookie por su nombre:
* @throws CookieException si las cabeceras ya han sido enviadas.
* @throws CookieException si falla el análisis de la cadena de fecha/hora.
*/
Cookie::remove(string $name): void
Cookie::remove(string $name): void;
```

## Excepciones utilizadas
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## [v2.0.6](https://github.com/josantonius/php-json/releases/tag/v2.0.6) (2022-XX-XX)

* The notation type in the test function names has been changed from camel to snake case for readability.

* A semicolon has been added at the end of the documented methods to avoid confusion.

* Disabled the ´CamelCaseMethodName´ rule in ´phpmd.xml´ to avoid warnings about function names in tests.

* The alignment of the asterisks in the comments has been fixed.

## [2.0.5](https://github.com/josantonius/php-cookie/releases/tag/2.0.5) (2022-08-11)

* Improved documentation.
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ $cookie->set(
string $name,
mixed $value,
null|int|string|DateTime $expires = null
): void
): void;
```

Sets several cookies at once:
Expand All @@ -125,7 +125,7 @@ Sets several cookies at once:
$cookie->replace(
array $data,
null|int|string|DateTime $expires = null
): void
): void;
```

Gets a cookie by name:
Expand All @@ -134,19 +134,19 @@ Gets a cookie by name:
/**
* Optionally defines a default value when the cookie does not exist.
*/
$cookie->get(string $name, mixed $default = null): mixed
$cookie->get(string $name, mixed $default = null): mixed;
```

Gets all cookies:

```php
$cookie->all(): array
$cookie->all(): array;
```

Check if a cookie exists:

```php
$cookie->has(string $name): bool
$cookie->has(string $name): bool;
```

Deletes a cookie by name and returns its value:
Expand All @@ -157,7 +157,7 @@ Deletes a cookie by name and returns its value:
*
* @throws CookieException if headers already sent.
*/
$cookie->pull(string $name, mixed $default = null): mixed
$cookie->pull(string $name, mixed $default = null): mixed;
```

Deletes an cookie by name:
Expand All @@ -167,7 +167,7 @@ Deletes an cookie by name:
* @throws CookieException if headers already sent.
* @throws CookieException if failure in date/time string analysis.
*/
$cookie->remove(string $name): void
$cookie->remove(string $name): void;
```

### Cookie Facade
Expand Down Expand Up @@ -220,7 +220,7 @@ Cookie::set(
string $name,
mixed $value,
null|int|string|DateTime $expires = null
): void
): void;
```

Sets several cookies at once:
Expand All @@ -234,7 +234,7 @@ Sets several cookies at once:
Cookie::replace(
array $data,
null|int|string|DateTime $expires = null
): void
): void;
```

Gets a cookie by name:
Expand All @@ -243,19 +243,19 @@ Gets a cookie by name:
/**
* Optionally defines a default value when the cookie does not exist.
*/
Cookie::get(string $name, mixed $default = null): mixed
Cookie::get(string $name, mixed $default = null): mixed;
```

Gets all cookies:

```php
Cookie::all(): array
Cookie::all(): array;
```

Check if a cookie exists:

```php
Cookie::has(string $name): bool
Cookie::has(string $name): bool;
```

Deletes a cookie by name and returns its value:
Expand All @@ -266,7 +266,7 @@ Deletes a cookie by name and returns its value:
*
* @throws CookieException if headers already sent.
*/
Cookie::pull(string $name, mixed $default = null): mixed
Cookie::pull(string $name, mixed $default = null): mixed;
```

Deletes an cookie by name:
Expand All @@ -276,7 +276,7 @@ Deletes an cookie by name:
* @throws CookieException if headers already sent.
* @throws CookieException if failure in date/time string analysis.
*/
Cookie::remove(string $name): void
Cookie::remove(string $name): void;
```

## Exceptions Used
Expand Down
6 changes: 4 additions & 2 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0"?>
<ruleset name="PHPMD rule set" xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
<ruleset name="PHPMD rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Coding standard.</description>
Expand Down Expand Up @@ -33,7 +35,7 @@
<!--<rule ref="rulesets/controversial.xml/Superglobals"/>-->
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
<!--<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>-->
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />

Expand Down
8 changes: 5 additions & 3 deletions tests/AllMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
*/

namespace Josantonius\Cookie\Tests;
Expand All @@ -29,15 +31,15 @@ public function setUp(): void
/**
* @runInSeparateProcess
*/
public function testShouldReturnEmptyArrayWhenThereAreNoCookies(): void
public function test_should_return_empty_array_when_there_are_no_cookies(): void
{
$this->assertEmpty($this->cookie->all());
}

/**
* @runInSeparateProcess
*/
public function testShouldGetAllCookies(): void
public function test_should_get_all_cookies(): void
{
$this->cookie->set('foo', 'bar');
$this->cookie->set('bar', 'foo');
Expand All @@ -51,7 +53,7 @@ public function testShouldGetAllCookies(): void
/**
* @runInSeparateProcess
*/
public function testShouldBeAvailableFromTheFacade(): void
public function test_should_be_available_from_the_facade(): void
{
$facade = new CookieFacade();

Expand Down
6 changes: 4 additions & 2 deletions tests/ClearMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
*/

namespace Josantonius\Cookie\Tests;
Expand All @@ -29,7 +31,7 @@ public function setUp(): void
/**
* @runInSeparateProcess
*/
public function testShouldClearAllCookies(): void
public function test_should_clear_all_cookies(): void
{
$this->cookie->set('foo', 'bar');
$this->cookie->set('bar', 'foo');
Expand All @@ -42,7 +44,7 @@ public function testShouldClearAllCookies(): void
/**
* @runInSeparateProcess
*/
public function testShouldBeAvailableFromTheFacade(): void
public function test_should_be_available_from_the_facade(): void
{
$facade = new CookieFacade();

Expand Down
8 changes: 5 additions & 3 deletions tests/ConstructorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
*/

namespace Josantonius\Cookie\Tests;
Expand All @@ -28,7 +30,7 @@ public function setUp(): void
$this->cookie = new Cookie();
}

public function testShouldCreateInstanceWithDefaultValues(): void
public function test_should_create_instance_with_default_values(): void
{
$cookie = new Cookie();

Expand All @@ -43,7 +45,7 @@ public function testShouldCreateInstanceWithDefaultValues(): void
$this->assertEquals($this->getPrivateProperty($cookie, 'secure'), false);
}

public function testShouldCreateInstanceWithCustomValues(): void
public function test_should_create_instance_with_custom_values(): void
{
$cookie = new Cookie(
domain: 'example.com',
Expand All @@ -66,7 +68,7 @@ public function testShouldCreateInstanceWithCustomValues(): void
$this->assertEquals($this->getPrivateProperty($cookie, 'secure'), true);
}

public function testShouldFailIfSameSiteValueIsWrong(): void
public function test_should_fail_if_same_site_value_is_wrong(): void
{
$this->expectException(CookieException::class);

Expand Down
Loading