From df36e99bdf1f4504a74d9e94bde3d3cd8df9f98c Mon Sep 17 00:00:00 2001 From: Claudson Martins Date: Thu, 23 Jan 2020 14:24:34 -0300 Subject: [PATCH 1/3] Adicionado toString na classe address --- src/Address.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Address.php b/src/Address.php index ff2e3be..7e2fbb3 100644 --- a/src/Address.php +++ b/src/Address.php @@ -70,4 +70,14 @@ public function toArray() { return (array) $this; } + + /** + * Converte a instância da classe em JSON. + * + * @return string + */ + public function __toString() + { + return json_encode($this->toArray()); + } } From 391ff8b2531d5456a5e379d2f9ffbc714ca255c0 Mon Sep 17 00:00:00 2001 From: Claudson Martins Date: Thu, 23 Jan 2020 14:30:47 -0300 Subject: [PATCH 2/3] Adicionada badge do packagist download --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae4fac8..ccd088d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # CEP Promise PHP [![Build Status](https://travis-ci.org/claudsonm/cep-promise-php.svg?branch=master)](https://travis-ci.org/claudsonm/cep-promise-php) [![StyleCI](https://github.styleci.io/repos/177436507/shield?branch=master)](https://github.styleci.io/repos/177436507) +![Packagist](https://img.shields.io/packagist/dt/claudsonm/cep-promise-php?style=flat-square) [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors) Um pacote agnóstico para PHP 7.0+ que efetua a busca de CEPs em diversos serviços utilizando [Promises/A+](https://promisesaplus.com/). From eddf94bcd0597ab4d6a487636266085132da71ba Mon Sep 17 00:00:00 2001 From: Claudson Martins Date: Thu, 23 Jan 2020 14:35:42 -0300 Subject: [PATCH 3/3] Stylecheck fixes --- src/CepPromise.php | 8 ++++---- src/Providers/CepAbertoProvider.php | 6 +++--- src/Providers/CorreiosProvider.php | 6 +++--- src/Providers/ViaCepProvider.php | 6 +++--- tests/Unit/CepPromiseUnitTest.php | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/CepPromise.php b/src/CepPromise.php index a3f87d9..642c403 100644 --- a/src/CepPromise.php +++ b/src/CepPromise.php @@ -2,13 +2,13 @@ namespace Claudsonm\CepPromise; +use Claudsonm\CepPromise\Exceptions\CepPromiseException; +use Claudsonm\CepPromise\Providers\CepAbertoProvider; +use Claudsonm\CepPromise\Providers\CorreiosProvider; +use Claudsonm\CepPromise\Providers\ViaCepProvider; use Exception; use GuzzleHttp\Promise; use GuzzleHttp\Promise\FulfilledPromise; -use Claudsonm\CepPromise\Providers\ViaCepProvider; -use Claudsonm\CepPromise\Providers\CorreiosProvider; -use Claudsonm\CepPromise\Providers\CepAbertoProvider; -use Claudsonm\CepPromise\Exceptions\CepPromiseException; /** * Efetua a consulta pelas informações de um CEP em diferentes serviços de diff --git a/src/Providers/CepAbertoProvider.php b/src/Providers/CepAbertoProvider.php index 9f4e792..4321d1f 100644 --- a/src/Providers/CepAbertoProvider.php +++ b/src/Providers/CepAbertoProvider.php @@ -2,11 +2,11 @@ namespace Claudsonm\CepPromise\Providers; -use Exception; -use Psr\Http\Message\ResponseInterface; -use GuzzleHttp\Exception\RequestException; use Claudsonm\CepPromise\Contracts\BaseProvider; use Claudsonm\CepPromise\Exceptions\CepPromiseProviderException; +use Exception; +use GuzzleHttp\Exception\RequestException; +use Psr\Http\Message\ResponseInterface; class CepAbertoProvider extends BaseProvider { diff --git a/src/Providers/CorreiosProvider.php b/src/Providers/CorreiosProvider.php index 18aad5b..e3d17aa 100644 --- a/src/Providers/CorreiosProvider.php +++ b/src/Providers/CorreiosProvider.php @@ -2,11 +2,11 @@ namespace Claudsonm\CepPromise\Providers; -use Exception; -use Psr\Http\Message\ResponseInterface; -use GuzzleHttp\Exception\RequestException; use Claudsonm\CepPromise\Contracts\BaseProvider; use Claudsonm\CepPromise\Exceptions\CepPromiseProviderException; +use Exception; +use GuzzleHttp\Exception\RequestException; +use Psr\Http\Message\ResponseInterface; class CorreiosProvider extends BaseProvider { diff --git a/src/Providers/ViaCepProvider.php b/src/Providers/ViaCepProvider.php index 065a60d..c3bab0b 100644 --- a/src/Providers/ViaCepProvider.php +++ b/src/Providers/ViaCepProvider.php @@ -2,11 +2,11 @@ namespace Claudsonm\CepPromise\Providers; -use Exception; -use Psr\Http\Message\ResponseInterface; -use GuzzleHttp\Exception\RequestException; use Claudsonm\CepPromise\Contracts\BaseProvider; use Claudsonm\CepPromise\Exceptions\CepPromiseProviderException; +use Exception; +use GuzzleHttp\Exception\RequestException; +use Psr\Http\Message\ResponseInterface; class ViaCepProvider extends BaseProvider { diff --git a/tests/Unit/CepPromiseUnitTest.php b/tests/Unit/CepPromiseUnitTest.php index 16c1a38..ede5317 100644 --- a/tests/Unit/CepPromiseUnitTest.php +++ b/tests/Unit/CepPromiseUnitTest.php @@ -2,11 +2,11 @@ namespace Claudsonm\CepPromise\Tests\Unit; -use ReflectionMethod; -use PHPUnit\Framework\TestCase; use Claudsonm\CepPromise\Address; use Claudsonm\CepPromise\CepPromise; use Claudsonm\CepPromise\Exceptions\CepPromiseException; +use PHPUnit\Framework\TestCase; +use ReflectionMethod; class CepPromiseUnitTest extends TestCase {