Skip to content

Commit 53ce61a

Browse files
authored
Merge pull request #3 from josantonius/pre-release/v2.0.4
pre-release/v2.0.4
2 parents 6b46ec3 + f9a4271 commit 53ce61a

File tree

6 files changed

+55
-51
lines changed

6 files changed

+55
-51
lines changed

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Biblioteca de PHP para obtener mensajes y definiciones de códigos de estado HTT
1717

1818
- [Requisitos](#requisitos)
1919
- [Instalación](#instalación)
20-
- [Available Classes](#available-classes)
20+
- [Clases disponibles](#clases-disponibles)
2121
- [Clase HttpStatusCode](#clase-httpstatuscode)
2222
- [Excepciones utilizadas](#excepciones-utilizadas)
2323
- [Uso](#uso)
2424
- [Listado en formato JSON](#listado-en-formato-json)
2525
- [Tests](#tests)
26-
- [Tareas pendientes](#-tareas-pendientes)
26+
- [Tareas pendientes](#tareas-pendientes)
2727
- [Registro de Cambios](#registro-de-cambios)
2828
- [Contribuir](#contribuir)
2929
- [Patrocinar](#patrocinar)
@@ -62,9 +62,7 @@ git clone https://github.com/josantonius/http-status-code.git
6262

6363
### Clase HttpStatusCode
6464

65-
```php
66-
use Josantonius\HttpStatusCode\HttpStatusCode;
67-
```
65+
`Josantonius\HttpStatusCode\HttpStatusCode`
6866

6967
Crear una nueva instancia que defina el idioma:
7068

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

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

8583
```php
86-
$httpStatusCode->getMessage(int $code): string|null
84+
public function getMessage(int $code): string|null;
8785
```
8886

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

9189
```php
92-
$httpStatusCode->getMessages(): array
90+
public function getMessages(): array;
9391
```
9492

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

9795
```php
98-
$httpStatusCode->getDefinition(int $code): string|null
96+
public function getDefinition(int $code): string|null;
9997
```
10098

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

103101
```php
104-
$httpStatusCode->getDefinitions(): array
102+
public function getDefinitions(): array;
105103
```
106104

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

109107
```php
110-
$httpStatusCode->getAll(): array
108+
public function getAll(): array;
111109
```
112110

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

125123
```php
124+
use Josantonius\HttpStatusCode\HttpStatusCode;
125+
126126
$httpStatusCode = new HttpStatusCode(); // Obtiene los mensajes en inglés.
127127
```
128128

129129
```php
130+
use Josantonius\HttpStatusCode\HttpStatusCode;
131+
130132
$httpStatusCode = new HttpStatusCode('es'); // Obtiene los mensajes en español.
131133
```
132134

@@ -235,9 +237,9 @@ $httpStatusCode->getAll();
235237
]
236238
```
237239

238-
## List in Json format
240+
## Listado en formato JSON
239241

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

242244
## Tests
243245

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PHP library to get HTTP status code messages and definitions.
2626
- [TODO](#todo)
2727
- [Changelog](#changelog)
2828
- [Contribution](#contribution)
29-
- [Sponsor](#Sponsor)
29+
- [Sponsor](#sponsor)
3030
- [License](#license)
3131

3232
---
@@ -62,9 +62,7 @@ git clone https://github.com/josantonius/http-status-code.git
6262

6363
### HttpStatusCode Class
6464

65-
```php
66-
use Josantonius\HttpStatusCode\HttpStatusCode;
67-
```
65+
`Josantonius\HttpStatusCode\HttpStatusCode`
6866

6967
Create a new instance defining the language:
7068

@@ -77,37 +75,37 @@ Create a new instance defining the language:
7775
*
7876
* @throws UnsupportedLanguageException if language is not supported.
7977
*/
80-
$httpStatusCode = new HttpStatusCode(string $language = 'en');
78+
public function __construct(string $language = 'en');
8179
```
8280

8381
Gets message of an HTTP status code:
8482

8583
```php
86-
$httpStatusCode->getMessage(int $code): string|null
84+
public function getMessage(int $code): string|null;
8785
```
8886

8987
Gets the messages of all HTTP status codes:
9088

9189
```php
92-
$httpStatusCode->getMessages(): array
90+
public function getMessages(): array;
9391
```
9492

9593
Gets definition of an HTTP status code:
9694

9795
```php
98-
$httpStatusCode->getDefinition(int $code): string|null
96+
public function getDefinition(int $code): string|null;
9997
```
10098

10199
Gets the definitions of all HTTP status codes:
102100

103101
```php
104-
$httpStatusCode->getDefinitions(): array
102+
public function getDefinitions(): array;
105103
```
106104

107105
Gets messages and definitions of all HTTP status codes:
108106

109107
```php
110-
$httpStatusCode->getAll(): array
108+
public function getAll(): array;
111109
```
112110

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

131129
```php
130+
use Josantonius\HttpStatusCode\HttpStatusCode;
131+
132132
$httpStatusCode = new HttpStatusCode('es'); // Gets the messages in Spanish.
133133
```
134134

phpmd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<rule ref="rulesets/controversial.xml/Superglobals"/>
3535
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
3636
<rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
37-
<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
37+
<!--<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>-->
3838
<rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
3939
<rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
4040

src/Exceptions/UnsupportedLanguageException.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-http-status-code repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-http-status-code repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
1111

1212
namespace Josantonius\HttpStatusCode\Exceptions;
1313

src/HttpStatusCode.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
declare(strict_types=1);
44

55
/*
6-
* This file is part of https://github.com/josantonius/php-http-status-code repository.
7-
*
8-
* (c) Josantonius <hello@josantonius.dev>
9-
*
10-
* For the full copyright and license information, please view the LICENSE
11-
* file that was distributed with this source code.
12-
*/
6+
* This file is part of https://github.com/josantonius/php-http-status-code repository.
7+
*
8+
* (c) Josantonius <hello@josantonius.dev>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
1313

1414
namespace Josantonius\HttpStatusCode;
1515

tests/HttpStatusCodeTest.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

33
/*
4-
* This file is part of https://github.com/josantonius/php-http-status-code repository.
5-
*
6-
* (c) Josantonius <hello@josantonius.dev>
7-
*
8-
* For the full copyright and license information, please view the LICENSE
9-
* file that was distributed with this source code.
10-
*/
4+
* This file is part of https://github.com/josantonius/php-http-status-code repository.
5+
*
6+
* (c) Josantonius <hello@josantonius.dev>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
12+
*/
1113

1214
namespace Josantonius\HttpStatusCode\Tests;
1315

@@ -29,14 +31,14 @@ public function setUp(): void
2931
$this->httpStatusCodeEs = new HttpStatusCode('es');
3032
}
3133

32-
public function testShouldFailIfUnsupportedLanguageIsUsed()
34+
public function test_should_fail_if_unsupported_language_is_used()
3335
{
3436
$this->expectException(UnsupportedLanguageException::class);
3537

3638
new HttpStatusCode('fr');
3739
}
3840

39-
public function testShouldGetMessage()
41+
public function test_should_get_message()
4042
{
4143
$this->assertEquals(
4244
'Request Time-out',
@@ -49,15 +51,15 @@ public function testShouldGetMessage()
4951
);
5052
}
5153

52-
public function testShouldGetMessages()
54+
public function test_should_get_messages()
5355
{
5456
$messages = $this->httpStatusCodeEn->getMessages();
5557

5658
$this->assertIsArray($messages);
5759
$this->assertArrayHasKey(408, $messages);
5860
}
5961

60-
public function testShouldGetDefinition()
62+
public function test_should_get_definition()
6163
{
6264
$this->assertStringContainsString(
6365
'The server timed out waiting for the request.',
@@ -70,15 +72,15 @@ public function testShouldGetDefinition()
7072
);
7173
}
7274

73-
public function testShouldGetDefinitions()
75+
public function test_should_get_definitions()
7476
{
7577
$definitions = $this->httpStatusCodeEn->getDefinitions();
7678

7779
$this->assertIsArray($definitions);
7880
$this->assertArrayHasKey(408, $definitions);
7981
}
8082

81-
public function testShouldGetAll()
83+
public function test_should_get_all()
8284
{
8385
$all = $this->httpStatusCodeEn->getAll();
8486

0 commit comments

Comments
 (0)