Skip to content

Commit

Permalink
Merge pull request #113 from johnzuk/6.0.0
Browse files Browse the repository at this point in the history
New 6.0.0 version
  • Loading branch information
johnzuk authored Oct 20, 2022
2 parents 181d45c + b7adf71 commit 7a29814
Show file tree
Hide file tree
Showing 78 changed files with 1,426 additions and 1,801 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Static Analysis

on:
push:
pull_request:

jobs:
composer:
name: Composer validation
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer:2.4.3
coverage: none

- name: Execute composer validate
run: composer validate --strict

phpcs:
name: PHPCs
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer:2.4.3
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPCs
run: vendor/bin/phpcs src tests


phpstan:
name: PHPStan
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer:2.4.3
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPStan
run: vendor/bin/phpstan analyze -c phpstan.neon src tests --no-progress
66 changes: 66 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tests

on:
push:
pull_request:

jobs:
tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-20.04

strategy:
matrix:
php: ['8.0', '8.1', '8.2']

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:2.4.3
coverage: none

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit

coverage:
name: Test Coverage
runs-on: ubuntu-20.04

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer:2.4.3
coverage: pcov

- name: Install Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --no-interaction --no-progress

- name: Execute PHPUnit
run: vendor/bin/phpunit --coverage-clover=./coverage.xml

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
verbose: true
25 changes: 25 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in('./src')
->in('./tests');
;

$config = new PhpCsFixer\Config();
return $config->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'phpdoc_add_missing_param_annotation' => true,
'linebreak_after_opening_tag' => true,
'phpdoc_summary' => false,
'phpdoc_no_package' => false,
'phpdoc_order' => true,
'phpdoc_align' => true,
'ordered_imports' => true,
'native_function_invocation' => true,
'@PSR12' => true,
'strict_param' => true,
'declare_strict_types' => true,
])
->setFinder($finder)
;
19 changes: 0 additions & 19 deletions .php_cs.dist

This file was deleted.

6 changes: 1 addition & 5 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
preset: recommended

disabled:
- align_double_arrow
- no_multiline_whitespace_before_semicolons
preset: psr12
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

59 changes: 18 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,19 @@ composer require gusapi/gusapi

Supported Versions
==================
|Version|PHP version | BIR service version | Support | Doc |
|-------|------------|--------|----------------------------------|------|
|5.x | >= 7.1 | BIR1.1 (available since May 2019) | Support ends on December 1, 2020 | [Doc](https://github.com/johnzuk/GusApi/blob/master/README.md)|
|4.x | >= 7.1 | BIR1 | Support ends on December 1, 2019 | [Doc](https://github.com/johnzuk/GusApi/tree/4.0.2/README.md)|
|3.3.x | >= 5.6 | BIR1 | Support ends on December 1, 2018 | [Doc](https://github.com/johnzuk/GusApi/blob/3.3/README.md) |
|3.2.x | >= 5.4 | BIR1 | Support ended on April 1, 2018 | [Doc](https://github.com/johnzuk/GusApi/blob/3.2/README.md) |

If you still use PHP <= 7.0 see documentation for 3.3.x version [HERE](https://github.com/johnzuk/GusApi/blob/3.3/README.md)
| Version | PHP version | BIR service version | Support | Doc |
|---------|-------------|---------------------------------------|----------------------------------|------|
| 6.x | >= 8.0 | BIR1.1 (available since October 2022) | Support ends on April 1, 2023 | [Doc](https://github.com/johnzuk/GusApi/blob/master/README.md)|
| 5.x | >= 7.1 | BIR1.1 (available since May 2019) | Support ends on December 1, 2020 | [Doc](https://github.com/johnzuk/GusApi/blob/5.0.0/README.md)|

If you still use PHP <= 8.0 see documentation for 5.x version [HERE](https://github.com/johnzuk/GusApi/blob/5.0.0/README.md)
-------------------
New in 5.x (this version support BIR1.1)
========================================
* New properties in `SearchReport`:
* nip
* nipStatus
* propertyNumber
* apartmentNumber
* activityEndDate

**Till version 5.x you dont need to get full report to find property number and apartment number**

* Method getFullReport throws `InvalidReportTypeException` for invalid report name
* Method dataStatus now return `DateTimeImmutable` instead of `DateTime` and throws `InvalidServerResponseException`
* New method getBulkReport - new search type in BIR1.1 (mode documentation [here](https://api.stat.gov.pl/Home/RegonApi))
with `BulkReportTypes`
* New supported report types for `getBulkReport` method (based on BIR1.1 documentation):
```php
public const REPORT_NEW_LEGAL_ENTITY_AND_NATURAL_PERSON = 'BIR11NowePodmiotyPrawneOrazDzialalnosciOsFizycznych';
public const REPORT_UPDATED_LEGAL_ENTITY_AND_NATURAL_PERSON = 'BIR11AktualizowanePodmiotyPrawneOrazDzialalnosciOsFizycznych';
public const REPORT_DELETED_LEGAL_ENTITY_AND_NATURAL_PERSON = 'BIR11SkreslonePodmiotyPrawneOrazDzialalnosciOsFizycznych';
public const REPORT_NEW_LOCAL_UNITS = 'BIR11NoweJednostkiLokalne';
public const REPORT_UPDATED_LOCAL_UNITS = 'BIR11AktualizowaneJednostkiLokalne';
public const REPORT_DELETED_LOCAL_UNITS = 'BIR11SkresloneJednostkiLokalne';
```

* Remove `ReportTypeMapper`

Upgrade from 4.x to 5.x
Upgrade from 5.x to 6.x
=========================
For more information see [UPGRADE.md](UPGRADE.md).


Example for 5.x
Example for 6.x
======================
See file [examples/readmeExample.php](examples/readmeExample.php).

Expand All @@ -88,14 +59,15 @@ try {
var_dump($gus->dataStatus());
var_dump($gus->getBulkReport(
new DateTimeImmutable('2019-05-31'),
BulkReportTypes::REPORT_DELETED_LOCAL_UNITS));
BulkReportTypes::REPORT_DELETED_LOCAL_UNITS
));

foreach ($gusReports as $gusReport) {
//you can change report type to other one
$reportType = ReportTypes::REPORT_PERSON;
echo $gusReport->getName();
echo 'Address: '. $gusReport->getStreet(). ' ' . $gusReport->getPropertyNumber() . '/' . $gusReport->getApartmentNumber();
echo 'Address: ' . $gusReport->getStreet() . ' ' . $gusReport->getPropertyNumber() . '/' . $gusReport->getApartmentNumber();

$fullReport = $gus->getFullReport($gusReport, $reportType);
var_dump($fullReport);
}
Expand All @@ -104,7 +76,12 @@ try {
} catch (NotFoundException $e) {
echo 'No data found <br>';
echo 'For more information read server message below: <br>';
echo $gus->getResultSearchMessage();
echo sprintf(
"StatusSesji:%s\nKomunikatKod:%s\nKomunikatTresc:%s\n",
$gus->getSessionStatus(),
$gus->getMessageCode(),
$gus->getMessage()
);
}

```
Expand Down
52 changes: 25 additions & 27 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
# UPGRADE FROM 4.x to 5.0
# UPGRADE FROM 5.x to 6.0

Installation
------------
Before upgrading this package make sure you are using [PHP 7.1](http://php.net/migration71) or newer as it is required to run version 5.0 of this library.
Before upgrading this package make sure you are using [PHP 8.0](http://php.net/migration80) or newer as it is required to run version 5.0 of this library.

To upgrade, simply run:
```bash
composer require gusapi/gusapi ^5.0
composer require gusapi/gusapi ^6.0
```

Everything should work the same as in versions 4.x -
Everything should work the same as in versions 5.x -

GusApi
-------
* The `GusApi::getFullReport` now throws `InvalidReportTypeException` for invalid report name.
* The `GusApi::getUserKey` has been removed.

* The `getBulkReport` method added.
* The `GusApi::setUserKey` has been removed.

* The `GusApi::dataStatus` now returns `DateTimeImmutable` instead of `DateTime`.
* The `GusApi::setSessionId` has been removed.

* The `GusApi::dataStatus` now throws `InvalidServerResponseException` exception.
* The `GusApi::getResultSearchMessage` has been removed.

SearchReport
ReportTypes
-----

* Property `SearchReport::$regon14` has been removed.

* The `SearchReport::$nip` `$nipStatus` `$propertyNumber` `$apartmentNumber` `$activityEndDate` properties have been added.

BulkReportTypes
------
* The `BulkReportTypes` has been added.

ReportTypeMapper
------
* The `ReportTypeMapper` has been removed.

Request
-----
* The `GetValue::setPNazwaParametru` method has been removed.

* The `GetFullReport::setPRegon` and `setPNazwaRaportu` methods have been removed.
* Const `ReportTypes::REPORT_ACTIVITY_PHYSIC_PERSON` has been removed and replaced by `ReportTypes::REPORT_PERSON`.
* Const `ReportTypes::REPORT_ACTIVITY_PHYSIC_CEIDG` has been removed and replaced by `ReportTypes::REPORT_PERSON_CEIDG`.
* Const `ReportTypes::REPORT_ACTIVITY_PHYSIC_AGRO` has been removed and replaced by `ReportTypes::REPORT_PERSON_AGRO`.
* Const `ReportTypes::REPORT_ACTIVITY_PHYSIC_OTHER_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_PERSON_OTHER`.
* Const `ReportTypes::REPORT_ACTIVITY_LOCAL_PHYSIC_WKR_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_PERSON_DELETED_BEFORE_20141108`.
* Const `ReportTypes::REPORT_LOCALS_PHYSIC_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_PERSON_LOCALS`.
* Const `ReportTypes::REPORT_LOCAL_PHYSIC_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_PERSON_LOCAL`.
* Const `ReportTypes::REPORT_ACTIVITY_PHYSIC_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_PERSON_ACTIVITY`.
* Const `ReportTypes::REPORT_ACTIVITY_LOCAL_PHYSIC_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_PERSON_LOCAL_ACTIVITY`.
* Const `ReportTypes::REPORT_PUBLIC_LAW` has been removed and replaced by `ReportTypes::REPORT_ORGANIZATION`.
* Const `ReportTypes::REPORT_ACTIVITY_LAW_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_ORGANIZATION_ACTIVITY`.
* Const `ReportTypes::REPORT_LOCALS_LAW_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_ORGANIZATION_LOCALS`.
* Const `ReportTypes::REPORT_LOCAL_LAW_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_ORGANIZATION_LOCAL`.
* Const `ReportTypes::REPORT_ACTIVITY_LOCAL_LAW_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_ORGANIZATION_LOCAL_ACTIVITY`.
* Const `ReportTypes::REPORT_COMMON_LAW_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_ORGANIZATION_PARTNERS`.
* Const `ReportTypes::REPORT_UNIT_TYPE_PUBLIC` has been removed and replaced by `ReportTypes::REPORT_UNIT_TYPE`.
Loading

0 comments on commit 7a29814

Please sign in to comment.