Skip to content

Commit f117b89

Browse files
authored
Merge pull request #18 from josantonius/release/v2.0.1
Release/v2.0.1
2 parents 563f70e + 64b1d89 commit f117b89

20 files changed

+727
-570
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/.github export-ignore
22
/tests export-ignore
33
CHANGELOG.md export-ignore
4-
README.md export-ignore
54
phpcs.xml export-ignore
65
phpunit.xml export-ignore
76
phpmd.xml export-ignore

.github/CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ appropriate category for it:
4242
## Add or Improve a Feature?
4343

4444
- For a **Major Feature**,
45-
first [open a new discussion](https://github.com/josantonius/php-json/discussions/new) in the `Ideas` category and outline your proposal so that it can be discussed. This will also allow us to better
46-
coordinate our efforts, prevent duplication of work, and help you to craft the change so that it is
47-
successfully accepted into the project.
45+
first [open a new discussion](https://github.com/josantonius/php-json/discussions/new) in the
46+
`Ideas` category and outline your proposal so that it can be discussed. This will also allow us to
47+
better coordinate our efforts, prevent duplication of work, and help you to craft the change so that
48+
it is successfully accepted into the project.
4849

4950
- **Small Features** can be crafted and directly
5051
[submitted as a Pull Request](#submitting-a-pull-request).

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ cambios desde la rama `main`:
172172

173173
Para garantizar la coherencia en todo el código fuente, ten en cuenta estas reglas mientras trabajas:
174174

175-
- Todas las características o correcciones de errores **deben ser probadas** por una o más especificaciones (pruebas unitarias).
175+
- Todas las características o correcciones de errores **deben ser probadas** por una o más
176+
especificaciones (pruebas unitarias).
176177

177178
Puedes utilizar el siguiente comando para comprobar las pruebas:
178179

@@ -222,7 +223,8 @@ El _`header`_ es obligatorio y debe ajustarse al formato para el
222223
El _`body`_ es opcional. Cuando está presente, debe tener al menos 20 caracteres y debe
223224
ajustarse al formato del [cuerpo del _commit_](#cuerpo-del-commit).
224225

225-
El _`footer`_ es opcional. El formato para la [parte inferior del _commit_](#parte-inferior-del-commit) detalla la estructura que debe tener.
226+
El _`footer`_ es opcional.
227+
El formato para la [parte inferior del _commit_](#parte-inferior-del-commit) detalla su estructura.
226228

227229
### Cabecera del _commit_
228230

@@ -309,7 +311,8 @@ La sección de cambios de última hora debe comenzar con la frase "_BREAKING CHA
309311
resumen del cambio, una línea en blanco y una descripción detallada del cambio que incluya también
310312
instrucciones de migración.
311313

312-
Del mismo modo, una sección de desaprobación debe comenzar con "_DEPRECATED_:" seguido de una breve descripción sobre lo que quedó obsoleto, una línea en blanco y una descripción detallada que también
314+
Del mismo modo, una sección de desaprobación debe comenzar con "_DEPRECATED_:" seguido de una breve
315+
descripción sobre lo que quedó obsoleto, una línea en blanco y una descripción detallada que también
313316
recomiende una alternativa.
314317

315318
> Esta guía de contribución está inspirada en la

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

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
[![License](https://poser.pugx.org/josantonius/json/license)](LICENSE)
55
[![Total Downloads](https://poser.pugx.org/josantonius/json/downloads)](https://packagist.org/packages/josantonius/json)
66
[![CI](https://github.com/josantonius/php-json/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/josantonius/php-json/actions/workflows/ci.yml)
7-
[![PSR2](https://img.shields.io/badge/PSR-2-1abc9c.svg)](http://www.php-fig.org/psr/psr-2/)
8-
[![PSR4](https://img.shields.io/badge/PSR-4-9b59b6.svg)](http://www.php-fig.org/psr/psr-4/)
97
[![CodeCov](https://codecov.io/gh/josantonius/php-json/branch/main/graph/badge.svg)](https://codecov.io/gh/josantonius/php-json)
8+
[![PSR1](https://img.shields.io/badge/PSR-1-f57046.svg)](https://www.php-fig.org/psr/psr-1/)
9+
[![PSR4](https://img.shields.io/badge/PSR-4-9b59b6.svg)](https://www.php-fig.org/psr/psr-4/)
10+
[![PSR12](https://img.shields.io/badge/PSR-12-1abc9c.svg)](https://www.php-fig.org/psr/psr-12/)
1011

1112
**Traducciones**: [English](/README.md)
1213

@@ -30,15 +31,7 @@ Biblioteca PHP para la gestión de archivos JSON.
3031

3132
## Requisitos
3233

33-
Esta biblioteca es compatible desde la versión **8.0** de PHP hasta la versión **8.1** de PHP.
34-
35-
Para seguir utilizando la versión con métodos estáticos sin las nuevas características:
36-
37-
- Para versiones anteriores de PHP (desde la **5.6** hasta la **7.4**), puedes utilizar la
38-
[versión 1.1.9](https://github.com/josantonius/php-json/tree/1.1.9) de esta biblioteca.
39-
40-
- Para las versiones **8.0** y **8.1** de PHP, puedes utilizar la
41-
[version 1.2.0](https://github.com/josantonius/php-json/tree/1.2.0) de esta biblioteca.
34+
Esta biblioteca es compatible con las versiones de PHP: 8.0 | 8.1.
4235

4336
## Instalación
4437

@@ -73,17 +66,25 @@ Métodos disponibles en esta biblioteca:
7366
$json->get();
7467
```
7568

76-
**@throws** _CreateDirectoryException_ | _CreateFileException_ | _JsonErrorException_
69+
**@throws** `CreateDirectoryException` Si no se puede crear el directorio
70+
71+
**@throws** `CreateFileException` Si no se puede crear el archivo
7772

78-
**@Return** `array` - _Contenido del archivo_
73+
**@throws** `JsonErrorException` Si hay un error al analizar un archivo JSON
74+
75+
**@Return** `array` Contenido del archivo
7976

8077
### Establecer el contenido del archivo JSON
8178

8279
```php
8380
$json->set(array|object $content);
8481
```
8582

86-
**@throws** _CreateFileException_ | _JsonErrorException_ | _UnavailableMethodException_
83+
**@throws** `CreateFileException` Si no se puede crear el archivo
84+
85+
**@throws** `JsonErrorException` Si hay un error al analizar un archivo JSON
86+
87+
**@throws** `UnavailableMethodException` Si el método no está disponible
8788

8889
**@Return** `void`
8990

@@ -93,19 +94,31 @@ $json->set(array|object $content);
9394
$json->merge(array|object $content);
9495
```
9596

96-
**@throws** _CreateFileException_ | _GetFileException_ | _JsonErrorException_ | _UnavailableMethodException_
97+
**@throws** `CreateFileException` Si no se puede crear el archivo
9798

98-
**@Return** `array` - _Array resultante_
99+
**@throws** `GetFileException` Si no se puede obtener el archivo
100+
101+
**@throws** `JsonErrorException` Si hay un error al analizar un archivo JSON
102+
103+
**@throws** `UnavailableMethodException` Si el método no está disponible
104+
105+
**@Return** `array` Array resultante
99106

100107
### Incluir en el archivo JSON
101108

102109
```php
103110
$json->push(array|object $content);
104111
```
105112

106-
**@throws** _CreateFileException_ | _GetFileException_ | _JsonErrorException_ | _UnavailableMethodException_
113+
**@throws** `CreateFileException` Si no se puede crear el archivo
114+
115+
**@throws** `GetFileException` Si no se puede obtener el archivo
116+
117+
**@throws** `JsonErrorException` Si hay un error al analizar un archivo JSON
118+
119+
**@throws** `UnavailableMethodException` Si el método no está disponible
107120

108-
**@Return** `array` - _Array resultante_
121+
**@Return** `array` Array resultante
109122

110123
## Cómo empezar
111124

@@ -230,8 +243,7 @@ Ejecutar pruebas unitarias con [PHPUnit](https://phpunit.de/):
230243
composer phpunit
231244
```
232245

233-
Ejecutar pruebas de estándares de código [PSR2](http://www.php-fig.org/psr/psr-2/)
234-
con [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer):
246+
Ejecutar pruebas de estándares de código con [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer):
235247

236248
```console
237249
composer phpcs
@@ -273,8 +285,9 @@ _pull request_, comenzar una discusión o reportar un _issue_.
273285

274286
## Patrocinar
275287

276-
Si este proyecto te ayuda a reducir el tiempo de desarrollo y quieres agradecérmelo,
277-
[¡podrías patrocinarme!](https://github.com/josantonius/lang/es-ES/README.md#patrocinar) :blush:
288+
Si este proyecto te ayuda a reducir el tiempo de desarrollo,
289+
[puedes patrocinarme](https://github.com/josantonius/lang/es-ES/README.md#patrocinar)
290+
para apoyar mi trabajo :blush:
278291

279292
## Licencia
280293

CHANGELOG.md

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

3+
## [2.0.1](https://github.com/josantonius/php-json/releases/tag/2.0.1) (2022-06-28)
4+
5+
* Exceptions were refactored.
6+
7+
* Changes in documentation.
8+
9+
* New code style rules have been added.
10+
11+
* Implemented `PSR12 coding standard` from all library PHP files.
12+
13+
* DELETED:
14+
15+
`Josantonius\Json\Json::arrayToFile` method.
16+
17+
`Josantonius\Json\Json::fileToArray` method.
18+
19+
`Josantonius\Json\Tests\JsonTest` class.
20+
21+
* ADDED:
22+
23+
`Josantonius\Json\Tests\ConstructMethodTest` class.
24+
25+
`Josantonius\Json\Tests\GetMethodTest` class.
26+
27+
`Josantonius\Json\Tests\MergeMethodTest` class.
28+
29+
`Josantonius\Json\Tests\PushMethodTest` class.
30+
31+
`Josantonius\Json\Tests\SetMethodTest` class.
32+
333
## [2.0.0](https://github.com/josantonius/php-json/releases/tag/2.0.0) (2022-06-16)
434

535
* The library was completely refactored.

README.md

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
[![License](https://poser.pugx.org/josantonius/json/license)](LICENSE)
55
[![Total Downloads](https://poser.pugx.org/josantonius/json/downloads)](https://packagist.org/packages/josantonius/json)
66
[![CI](https://github.com/josantonius/php-json/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/josantonius/php-json/actions/workflows/ci.yml)
7-
[![PSR2](https://img.shields.io/badge/PSR-2-1abc9c.svg)](http://www.php-fig.org/psr/psr-2/)
8-
[![PSR4](https://img.shields.io/badge/PSR-4-9b59b6.svg)](http://www.php-fig.org/psr/psr-4/)
97
[![CodeCov](https://codecov.io/gh/josantonius/php-json/branch/main/graph/badge.svg)](https://codecov.io/gh/josantonius/php-json)
8+
[![PSR1](https://img.shields.io/badge/PSR-1-f57046.svg)](https://www.php-fig.org/psr/psr-1/)
9+
[![PSR4](https://img.shields.io/badge/PSR-4-9b59b6.svg)](https://www.php-fig.org/psr/psr-4/)
10+
[![PSR12](https://img.shields.io/badge/PSR-12-1abc9c.svg)](https://www.php-fig.org/psr/psr-12/)
1011

1112
**Translations**: [Español](.github/lang/es-ES/README.md)
1213

@@ -30,15 +31,7 @@ PHP simple library for managing JSON files.
3031

3132
## Requirements
3233

33-
This library is compatible from **PHP 8.0** version to **PHP 8.1** version.
34-
35-
To continue using the version with static methods without the new features:
36-
37-
- For older versions of PHP (from **5.6** to **7.4**),
38-
[version 1.1.9](https://github.com/josantonius/php-json/tree/1.1.9) of this library can be used.
39-
40-
- For PHP versions **8.0** and **8.1**,
41-
[version 1.2.0](https://github.com/josantonius/php-json/tree/1.2.0) of this library can be used.
34+
This library is compatible with the PHP versions: 8.0 | 8.1.
4235

4336
## Installation
4437

@@ -73,17 +66,25 @@ Available methods in this library:
7366
$json->get();
7467
```
7568

76-
**@throws** _CreateDirectoryException_ | _CreateFileException_ | _JsonErrorException_
69+
**@throws** `CreateDirectoryException` If there is an error when creating a directory
70+
71+
**@throws** `CreateFileException` If there is an error when creating a file
7772

78-
**@Return** `array` - _File contents_
73+
**@throws** `JsonErrorException` If there is an error when parsing a JSON file
74+
75+
**@Return** `array` File contents
7976

8077
### Set the content of the JSON file
8178

8279
```php
8380
$json->set(array|object $content);
8481
```
8582

86-
**@throws** _CreateFileException_ | _JsonErrorException_ | _UnavailableMethodException_
83+
**@throws** `CreateFileException` If there is an error when creating a file
84+
85+
**@throws** `JsonErrorException` If there is an error when parsing a JSON file
86+
87+
**@throws** `UnavailableMethodException` If the method is not available
8788

8889
**@Return** `void`
8990

@@ -93,19 +94,31 @@ $json->set(array|object $content);
9394
$json->merge(array|object $content);
9495
```
9596

96-
**@throws** _CreateFileException_ | _GetFileException_ | _JsonErrorException_ | _UnavailableMethodException_
97+
**@throws** `CreateFileException` If there is an error when creating a file
9798

98-
**@Return** `array` - _Resulting array_
99+
**@throws** `GetFileException` If there is an error when getting a file
100+
101+
**@throws** `JsonErrorException` If there is an error when parsing a JSON file
102+
103+
**@throws** `UnavailableMethodException` If the method is not available
104+
105+
**@Return** `array` Resulting array
99106

100107
### Push on the JSON file
101108

102109
```php
103110
$json->push(array|object $content);
104111
```
105112

106-
**@throws** _CreateFileException_ | _GetFileException_ | _JsonErrorException_ | _UnavailableMethodException_
113+
**@throws** `CreateFileException` If there is an error when creating a file
114+
115+
**@throws** `GetFileException` If there is an error when getting a file
116+
117+
**@throws** `JsonErrorException` If there is an error when parsing a JSON file
118+
119+
**@throws** `UnavailableMethodException` If the method is not available
107120

108-
**@Return** `array` - _Resulting array_
121+
**@Return** `array` Resulting array
109122

110123
## Quick Start
111124

@@ -230,8 +243,7 @@ Run unit tests with [PHPUnit](https://phpunit.de/):
230243
composer phpunit
231244
```
232245

233-
Run [PSR2](http://www.php-fig.org/psr/psr-2/) code standard tests with
234-
[PHPCS](https://github.com/squizlabs/PHP_CodeSniffer):
246+
Run code standard tests with [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer):
235247

236248
```console
237249
composer phpcs
@@ -271,8 +283,8 @@ Thanks to all [contributors](https://github.com/josantonius/php-json/graphs/cont
271283

272284
## Sponsor
273285

274-
If this project helps you to reduce your development time and you want to thank me,
275-
[you could sponsor me!](https://github.com/josantonius#sponsor) :blush:
286+
If this project helps you to reduce your development time,
287+
[you can sponsor me](https://github.com/josantonius#sponsor) to support my open source work :blush:
276288

277289
## License
278290

0 commit comments

Comments
 (0)