Skip to content

Commit

Permalink
melhorias e actions
Browse files Browse the repository at this point in the history
  • Loading branch information
robmachado committed Oct 13, 2021
1 parent bc6e74f commit b36043c
Show file tree
Hide file tree
Showing 54 changed files with 488 additions and 104 deletions.
Empty file modified .coverall.yml
100644 → 100755
Empty file.
Empty file modified .editorconfig
100644 → 100755
Empty file.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pipeline
on:
push:
branches:
- master

pull_request:
branches:
- master

jobs:
testsuite:
name: Testes Automatizados
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['7.1', '7.2', '7.3', '7.4']

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: json, curl

- name: checkout
uses: actions/checkout@v2

- name: Set phpunit version
if: matrix.php-version == '7.1'
run: composer require "phpunit/phpunit:^6.0" -W --dev

- name: Composer Install
run: |
composer install --no-progress -o --no-ansi --no-interaction
- name: Análises Estáticas
if: matrix.php-version != '7.1'
run: |
composer stan
- name: Rodanto PHPUnit
run: |
composer test
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .scrutinizer.yml
100644 → 100755
Empty file.
Empty file modified .styleci.yml
100644 → 100755
Empty file.
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

Empty file modified CHANGELOG.md
100644 → 100755
Empty file.
Empty file modified CONDUCT.md
100644 → 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
18 changes: 18 additions & 0 deletions Estados.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,22 @@ try {
}
```

## Estaticamente

A classe também pode ser invocada estaticamente.

```php
use NFePHP\Ibge\Ibge;

try {
$resp = Ibge::uf()->estados()->get();
echo "<pre>";
print_r($resp);
echo "</pre>";
} catch (\Exception $e) {
echo $e->getMessage();
}
```



Empty file modified LICENSE
100644 → 100755
Empty file.
29 changes: 23 additions & 6 deletions Municipios.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use NFePHP\Ibge\Ibge;
try {
$uf = 'SP';
$ibge = new Ibge();
$resp = $ibge->municipios($uf)->get();
$resp = $ibge->cidades($uf)->get();
echo "<pre>";
print_r($resp);
echo "</pre>";
Expand All @@ -33,7 +33,7 @@ use NFePHP\Ibge\Ibge;
try {
$uf = 35;
$ibge = new Ibge();
$resp = $ibge->municipios($uf)->toStd();
$resp = $ibge->cidades($uf)->toStd();
echo "<pre>";
print_r($resp);
echo "</pre>";
Expand All @@ -52,7 +52,7 @@ use NFePHP\Ibge\Ibge;
try {
$uf = 'AM';
$ibge = new Ibge();
$resp = $ibge->municipios($uf)->toArray();
$resp = $ibge->cidades($uf)->toArray();
echo "<pre>";
print_r($resp);
echo "</pre>";
Expand All @@ -74,7 +74,7 @@ try {
$uf = 'RJ';
$separador = '|';
$ibge = new Ibge();
$resp = $ibge->municipios($uf)->toCSV($separador);
$resp = $ibge->cidades($uf)->toCSV($separador);
echo "<pre>";
print_r($resp);
echo "</pre>";
Expand All @@ -98,7 +98,7 @@ try {
$uf = 'all';
$tabela = 'estados';
$ibge = new Ibge();
$resp = $ibge->municipios($uf)->toSQL($tabela);
$resp = $ibge->cidades($uf)->toSQL($tabela);
echo "<pre>";
print_r($resp);
echo "</pre>";
Expand All @@ -118,11 +118,28 @@ use NFePHP\Ibge\Ibge;

try {
$ibge = new Ibge();
$resp = $ibge->municipios('all')->refresh()->get();
$resp = $ibge->cidades('all')->refresh()->get();
echo "<pre>";
print_r($resp);
echo "</pre>";
} catch (\Exception $e) {
echo $e->getMessage();
}
```

## Estaticamente

A classe também pode ser invocada estaticamente.

```php
use NFePHP\Ibge\Ibge;

try {
$resp = Ibge::uf('AP')->cidades()->get();
echo "<pre>";
print_r($resp);
echo "</pre>";
} catch (\Exception $e) {
echo $e->getMessage();
}
```
3 changes: 1 addition & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Esta classe possui 2 métodos principais e vários modificadores.

## [function estados()](Estados.md)

## [function municipios($uf)](Municipios.md)
## [function cidades($uf)](Municipios.md)

> *IMPORTANTE: a pasta "storage" deve ter permissões de escrita pelo usuário que executa o PHP.*
Expand Down Expand Up @@ -86,7 +86,6 @@ Para que este pacote possa funcionar são necessários os seguintes requisitos d
[ico-version]: https://img.shields.io/packagist/v/nfephp-org/sped-ibge.svg
[link-packagist]: https://packagist.org/packages/nfephp-org/sped-ibge
[link-travis]: https://travis-ci.org/nfephp-org/sped-ibge
[link-scrutinizer]: https://scrutinizer-ci.com/g/nfephp-org/sped-ibge/code-structure
Expand Down
Empty file modified VERSION.txt
100644 → 100755
Empty file.
Empty file modified bootstrap.php
100644 → 100755
Empty file.
21 changes: 11 additions & 10 deletions composer.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
{
"name": "nfephp-org/sped-ibge",
"type": "library",
"description": "Librery to access the services of IBGE to obtain the codes used by the system SPED",
"description": "Library to access the services of IBGE to obtain the codes used by the system SPED",
"homepage": "https://github.com/nfephp-org/sped-ibge",
"keywords": ["Sped", "IBGE", "Municipios", "Estatos"],
"license": ["LGPL-3.0-or-later", "GPL-3.0-or-later", "MIT"],
"authors": [
{
"name": "Roberto L. Machado",
"email": "[email protected]",
"homepage": "https://github.com/nfephp-org",
"role": "Developer"
}
],
"require": {
"php" : ">=7.0",
"ext-curl": "*",
"ext-json": "*",
"league/flysystem": "^1.0"
"ext-json": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.8",
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "dev-master",
"phpunit/phpunit": "^6",
"scrutinizer/ocular": "^1.3",
"phpstan/phpstan": "^0.9.1"
"phpstan/phpstan": "^0.12.99",
"phpcompatibility/php-compatibility": "^9.3"
},
"autoload": {
"psr-4": {
Expand All @@ -35,10 +36,10 @@
}
},
"scripts": {
"test": "phpunit",
"phpcbf": "vendor/bin/phpcbf --standard=psr2 src/",
"phpcs": "vendor/bin/phpcs --standard=psr2 src/",
"phpstan": "vendor/bin/phpstan analyse src/ --level 7"
"test": "vendor/bin/phpunit -c phpunit.xml.dist",
"phpcbf": "vendor/bin/phpcbf src/ tests/",
"phpcs": "vendor/bin/phpcs src/ tests/",
"stan": "vendor/bin/phpstan analyse src/ tests/"
},
"extra": {
"branch-alias": {
Expand Down
15 changes: 15 additions & 0 deletions examples/testMun.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@

try {
$ibge = new Ibge();

//retorna JSON
$resp = $ibge->cidades('16')->get();

//retorna ARRAY
//$resp = $ibge->cidades('16')->toArray();

//retorna stdClass
//$resp = $ibge->cidades('16')->toStd();

//retorna CSV
//$resp = $ibge->cidades('16')->toCSV();

//retorna SQL
//$resp = $ibge->cidades('16')->toSQL();

echo "<pre>";
print_r($resp);
echo "</pre>";
Expand Down
Empty file modified examples/testUF.php
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
parameters:
ignoreErrors:
8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- phpstan-baseline.neon

parameters:
level: 5
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
Empty file modified phpunit.xml.dist
100644 → 100755
Empty file.
Loading

0 comments on commit b36043c

Please sign in to comment.