Skip to content

Release/v2.0.4 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 29, 2022
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
32 changes: 18 additions & 14 deletions .github/lang/es-ES/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Biblioteca de PHP para obtener mensajes y definiciones de códigos de estado HTT

- [Requisitos](#requisitos)
- [Instalación](#instalación)
- [Available Classes](#available-classes)
- [Clases disponibles](#clases-disponibles)
- [Clase HttpStatusCode](#clase-httpstatuscode)
- [Excepciones utilizadas](#excepciones-utilizadas)
- [Uso](#uso)
- [Listado en formato JSON](#listado-en-formato-json)
- [Tests](#tests)
- [Tareas pendientes](#-tareas-pendientes)
- [Tareas pendientes](#tareas-pendientes)
- [Registro de Cambios](#registro-de-cambios)
- [Contribuir](#contribuir)
- [Patrocinar](#patrocinar)
Expand All @@ -33,7 +33,9 @@ Biblioteca de PHP para obtener mensajes y definiciones de códigos de estado HTT

## Requisitos

Esta biblioteca es compatible con las versiones de PHP: 8.0 | 8.1.
- Sistema operativo: Linux | Windows.

- Versiones de PHP: 8.0 | 8.1 | 8.2.

## Instalación

Expand Down Expand Up @@ -62,9 +64,7 @@ git clone https://github.com/josantonius/http-status-code.git

### Clase HttpStatusCode

```php
use Josantonius\HttpStatusCode\HttpStatusCode;
```
`Josantonius\HttpStatusCode\HttpStatusCode`

Crear una nueva instancia que defina el idioma:

Expand All @@ -77,37 +77,37 @@ Crear una nueva instancia que defina el idioma:
*
* @throws UnsupportedLanguageException if language is not supported.
*/
$httpStatusCode = new HttpStatusCode(string $language = 'en');
public function __construct(string $language = 'en');
```

Obtiene el mensaje de un código de estado HTTP:

```php
$httpStatusCode->getMessage(int $code): string|null
public function getMessage(int $code): string|null;
```

Obtiene los mensajes de todos los códigos de estado HTTP:

```php
$httpStatusCode->getMessages(): array
public function getMessages(): array;
```

Obtiene la definición de un código de estado HTTP:

```php
$httpStatusCode->getDefinition(int $code): string|null
public function getDefinition(int $code): string|null;
```

Obtiene las definiciones de todos los códigos de estado HTTP:

```php
$httpStatusCode->getDefinitions(): array
public function getDefinitions(): array;
```

Obtiene mensajes y definiciones de todos los códigos de estado HTTP:

```php
$httpStatusCode->getAll(): array
public function getAll(): array;
```

## Excepciones utilizadas
Expand All @@ -123,10 +123,14 @@ Ejemplo de uso para esta biblioteca:
### Crear una nueva instancia que defina el idioma

```php
use Josantonius\HttpStatusCode\HttpStatusCode;

$httpStatusCode = new HttpStatusCode(); // Obtiene los mensajes en inglés.
```

```php
use Josantonius\HttpStatusCode\HttpStatusCode;

$httpStatusCode = new HttpStatusCode('es'); // Obtiene los mensajes en español.
```

Expand Down Expand Up @@ -235,9 +239,9 @@ $httpStatusCode->getAll();
]
```

## List in Json format
## Listado en formato JSON

[Go to the resource](https://gist.github.com/Josantonius/b455e315bc7f790d14b136d61d9ae469).
[Ir al recurso](https://gist.github.com/Josantonius/b455e315bc7f790d14b136d61d9ae469).

## Tests

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ jobs:
name: 'PHPUnit (PHP ${{ matrix.php }} - ${{ matrix.system }})'
strategy:
matrix:
system: ['ubuntu-latest']
system: ['ubuntu-latest', 'windows-latest']
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand Down
38 changes: 26 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# CHANGELOG

## [v2.0.3](https://github.com/josantonius/php-json/releases/tag/v2.0.3) (2022-08-11)
## [v2.0.4](https://github.com/josantonius/php-http-status-code/releases/tag/v2.0.4) (2022-09-29)

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

* Functions were added to document the methods and 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.

* Tests for Windows have been added.

* Tests for PHP 8.2 have been added.

## [v2.0.3](https://github.com/josantonius/php-http-status-code/releases/tag/v2.0.3) (2022-08-11)

* Improved documentation.

## [v2.0.2](https://github.com/josantonius/php-json/releases/tag/v2.0.2) (2022-08-04)
## [v2.0.2](https://github.com/josantonius/php-http-status-code/releases/tag/v2.0.2) (2022-08-04)

* Fix Packagist URL in `README.md` files

## [v2.0.1](https://github.com/josantonius/php-json/releases/tag/v2.0.1) (2022-07-31)
## [v2.0.1](https://github.com/josantonius/php-http-status-code/releases/tag/v2.0.1) (2022-07-31)

* The links in the `CHANGELOG.md` file have been fixed.

Expand All @@ -20,7 +34,7 @@

**Full Changelog**: <https://github.com/josantonius/php-http-status-code/compare/v2.0.0...v2.0.1>

## [v2.0.0](https://github.com/josantonius/php-json/releases/tag/v2.0.0) (2022-07-31)
## [v2.0.0](https://github.com/josantonius/php-http-status-code/releases/tag/v2.0.0) (2022-07-31)

> Version 1.x is considered as deprecated and unsupported.
> In this version (2.x) the library was completely restructured.
Expand Down Expand Up @@ -64,21 +78,21 @@
* Deleted `README-ES.MD` file.
* Deleted `.php_cs.dist` file.

## [1.1.6](https://github.com/josantonius/php-json/releases/tag/1.1.6) (2018-01-06)
## [1.1.6](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.6) (2018-01-06)

* The tests were fixed.

* Changes in documentation.

## [1.1.5](https://github.com/josantonius/php-json/releases/tag/1.1.5) (2017-11-08)
## [1.1.5](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.5) (2017-11-08)

* Implemented `PHP Mess Detector` to detect inconsistencies in code styles.

* Implemented `PHP Code Beautifier and Fixer` to fixing errors automatically.

* Implemented `PHP Coding Standards Fixer` to organize PHP code automatically according to PSR standards.

## [1.1.4](https://github.com/josantonius/php-json/releases/tag/1.1.4) (2017-10-30)
## [1.1.4](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.4) (2017-10-30)

* Implemented `PSR-4 autoloader standard` from all library files.

Expand Down Expand Up @@ -108,7 +122,7 @@

* Deleted `Josantonius\HTTPStatusCode\HTTPStatusCode::load()` method.

## [1.1.3](https://github.com/josantonius/php-json/releases/tag/1.1.3) (2017-09-13)
## [1.1.3](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.3) (2017-09-13)

* Unit tests supported by `PHPUnit` were added.

Expand Down Expand Up @@ -138,21 +152,21 @@

* Added `Josantonius\HTTPStatusCode\Test\HTTPStatusCodeTest::test()` method.

## [1.1.2](https://github.com/josantonius/php-json/releases/tag/1.1.2) (2017-07-16)
## [1.1.2](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.2) (2017-07-16)

* Deleted `Josantonius\HTTPStatusCode\Exception\HTTPStatusCodeException` class.
* Deleted `Josantonius\HTTPStatusCode\Exception\Exceptions` abstract class.
* Deleted `Josantonius\HTTPStatusCode\Exception\HTTPStatusCodeException->__construct()` method.

## [1.1.1](https://github.com/josantonius/php-json/releases/tag/1.1.1) (2017-03-18)
## [1.1.1](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.1) (2017-03-18)

* Some files were excluded from download and comments and readme files were updated.

## [1.1.0](https://github.com/josantonius/php-json/releases/tag/1.1.0) (2017-01-30)
## [1.1.0](https://github.com/josantonius/php-http-status-code/releases/tag/1.1.0) (2017-01-30)

* Compatible with PHP 5.6 or higher.

## [1.0.0](https://github.com/josantonius/php-json/releases/tag/1.0.0) (2016-12-19)
## [1.0.0](https://github.com/josantonius/php-http-status-code/releases/tag/1.0.0) (2016-12-19)

* 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.

Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ PHP library to get HTTP status code messages and definitions.
- [TODO](#todo)
- [Changelog](#changelog)
- [Contribution](#contribution)
- [Sponsor](#Sponsor)
- [Sponsor](#sponsor)
- [License](#license)

---

## Requirements

Esta biblioteca es compatible con las versiones de PHP: 8.0 | 8.1.
- Operating System: Linux | Windows.

- PHP versions: 8.0 | 8.1 | 8.2.

## Installation

Expand Down Expand Up @@ -62,9 +64,7 @@ git clone https://github.com/josantonius/http-status-code.git

### HttpStatusCode Class

```php
use Josantonius\HttpStatusCode\HttpStatusCode;
```
`Josantonius\HttpStatusCode\HttpStatusCode`

Create a new instance defining the language:

Expand All @@ -77,37 +77,37 @@ Create a new instance defining the language:
*
* @throws UnsupportedLanguageException if language is not supported.
*/
$httpStatusCode = new HttpStatusCode(string $language = 'en');
public function __construct(string $language = 'en');
```

Gets message of an HTTP status code:

```php
$httpStatusCode->getMessage(int $code): string|null
public function getMessage(int $code): string|null;
```

Gets the messages of all HTTP status codes:

```php
$httpStatusCode->getMessages(): array
public function getMessages(): array;
```

Gets definition of an HTTP status code:

```php
$httpStatusCode->getDefinition(int $code): string|null
public function getDefinition(int $code): string|null;
```

Gets the definitions of all HTTP status codes:

```php
$httpStatusCode->getDefinitions(): array
public function getDefinitions(): array;
```

Gets messages and definitions of all HTTP status codes:

```php
$httpStatusCode->getAll(): array
public function getAll(): array;
```

## Exceptions Used
Expand All @@ -129,6 +129,8 @@ $httpStatusCode = new HttpStatusCode(); // Gets the messages in English.
```

```php
use Josantonius\HttpStatusCode\HttpStatusCode;

$httpStatusCode = new HttpStatusCode('es'); // Gets the messages in Spanish.
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"htmlCoverage": "vendor/bin/phpunit --coverage-html coverage",
"phpcs": "vendor/bin/phpcs --standard=phpcs.xml $(find . -name '*.php');",
"phpmd": "vendor/bin/phpmd src,tests text ./phpmd.xml",
"phpunit": "vendor/bin/phpunit --colors=always;",
"phpunit": "vendor/bin/phpunit",
"tests": [
"clear",
"@phpmd",
Expand Down
2 changes: 1 addition & 1 deletion phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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
14 changes: 7 additions & 7 deletions src/Exceptions/UnsupportedLanguageException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

/*
* This file is part of https://github.com/josantonius/php-http-status-code repository.
*
* (c) Josantonius <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of https://github.com/josantonius/php-http-status-code repository.
*
* (c) Josantonius <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Josantonius\HttpStatusCode\Exceptions;

Expand Down
14 changes: 7 additions & 7 deletions src/HttpStatusCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
declare(strict_types=1);

/*
* This file is part of https://github.com/josantonius/php-http-status-code repository.
*
* (c) Josantonius <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of https://github.com/josantonius/php-http-status-code repository.
*
* (c) Josantonius <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Josantonius\HttpStatusCode;

Expand Down
Loading