-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from johnzuk/feature/architecture-upgrade
Feature/architecture upgrade
- Loading branch information
Showing
70 changed files
with
2,983 additions
and
840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
preset: recommended | ||
|
||
disabled: | ||
- align_double_arrow | ||
- no_multiline_whitespace_before_semicolons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# UPGRADE FROM 3.x to 4.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 4.0 of this library. | ||
|
||
To upgrade, simply run: | ||
```bash | ||
composer require gusapi/gusapi ^4.0 | ||
``` | ||
|
||
Creating the client | ||
------------------- | ||
Before: | ||
```php | ||
$gus = new GusApi( | ||
'abcde12345abcde12345', | ||
new \GusApi\Adapter\Soap\SoapAdapter( | ||
RegonConstantsInterface::BASE_WSDL_URL, | ||
RegonConstantsInterface::BASE_WSDL_ADDRESS | ||
) | ||
); | ||
``` | ||
|
||
After: | ||
```php | ||
$gus = new GusApi( | ||
'abcde12345abcde12345', | ||
'prod' // or 'dev' | ||
); | ||
``` | ||
|
||
Calling API methods | ||
------------------- | ||
The GusApi class now handles the session so you don't need to pass SID to every method. | ||
|
||
Before: | ||
```php | ||
$sessionId = $gus->login(); // returns SID on success | ||
$gusReports = $gus->getByNip($sessionId, '7740001454'); | ||
``` | ||
|
||
After: | ||
```php | ||
$loggedIn = $gus->login(); // returns true on success | ||
$gusReports = $gus->getByNip('7740001454'); | ||
|
||
// You can still fetch SID by calling: | ||
$sessionId = $gus->getSessionId(); | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
require_once '../vendor/autoload.php'; | ||
|
||
use GusApi\Exception\InvalidUserKeyException; | ||
use GusApi\GusApi; | ||
use GusApi\ReportTypes; | ||
|
||
$gus = new GusApi('your api key here'); | ||
//for development server use: | ||
//$gus = new GusApi('abcde12345abcde12345', 'dev'); | ||
|
||
try { | ||
$nipToCheck = 'xxxxxxxxxx'; //change to valid nip value | ||
$gus->login(); | ||
|
||
$gusReports = $gus->getByNip($nipToCheck); | ||
|
||
foreach ($gusReports as $gusReport) { | ||
//you can change report type to other one | ||
$reportType = ReportTypes::REPORT_PUBLIC_LAW; | ||
echo $gusReport->getName(); | ||
$fullReport = $gus->getFullReport($gusReport, $reportType); | ||
var_dump($fullReport); | ||
} | ||
} catch (InvalidUserKeyException $e) { | ||
echo 'Bad user key'; | ||
} catch (\GusApi\Exception\NotFoundException $e) { | ||
echo 'No data found <br>'; | ||
echo 'For more information read server message below: <br>'; | ||
echo $gus->getResultSearchMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
parameters: | ||
ignoreErrors: | ||
- '#stream_context_set_option invoked with 2 parameters, 4#' | ||
- '#GusApi\\Client\\SoapClient does not have a constructor#' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.