Skip to content

Commit

Permalink
Merge pull request #101 from krzyc/fix-report-types
Browse files Browse the repository at this point in the history
Fix and modify ReportTypes naming according to issue #100
  • Loading branch information
johnzuk authored Apr 5, 2021
2 parents c1552fa + 5c6a6a8 commit a9f777f
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ try {

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

Expand Down
2 changes: 1 addition & 1 deletion examples/readmeExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

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

Expand Down
119 changes: 76 additions & 43 deletions src/GusApi/ReportTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,86 @@

final class ReportTypes
{
public const REPORT_ACTIVITY_PHYSIC_PERSON = 'BIR11OsFizycznaDaneOgolne';
public const REPORT_ACTIVITY_PHYSIC_CEIDG = 'BIR11OsFizycznaDzialalnoscCeidg';
public const REPORT_ACTIVITY_PHYSIC_AGRO = 'BIR11OsFizycznaDzialalnoscRolnicza';
public const REPORT_ACTIVITY_PHYSIC_OTHER_PUBLIC = 'BIR11OsFizycznaDzialalnoscPozostala';
public const REPORT_ACTIVITY_LOCAL_PHYSIC_WKR_PUBLIC = 'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108';
public const REPORT_LOCALS_PHYSIC_PUBLIC = 'BIR11OsFizycznaPkd';
public const REPORT_LOCAL_PHYSIC_PUBLIC = 'BIR11OsFizycznaListaJednLokalnych';
public const REPORT_ACTIVITY_PHYSIC_PUBLIC = 'BIR11JednLokalnaOsFizycznej';
public const REPORT_ACTIVITY_LOCAL_PHYSIC_PUBLIC = 'BIR11JednLokalnaOsFizycznejPkd';
public const REPORT_PUBLIC_LAW = 'BIR11OsPrawna';
public const REPORT_ACTIVITY_LAW_PUBLIC = 'BIR11OsPrawnaPkd';
public const REPORT_LOCALS_LAW_PUBLIC = 'BIR11OsPrawnaListaJednLokalnych';
public const REPORT_LOCAL_LAW_PUBLIC = 'BIR11JednLokalnaOsPrawnej';
public const REPORT_ACTIVITY_LOCAL_LAW_PUBLIC = 'BIR11JednLokalnaOsPrawnejPkd';
public const REPORT_COMMON_LAW_PUBLIC = 'BIR11OsPrawnaSpCywilnaWspolnicy';
public const REPORT_UNIT_TYPE_PUBLIC = 'BIR11TypPodmiotu';
public const REPORT_PERSON = 'BIR11OsFizycznaDaneOgolne';
public const REPORT_PERSON_CEIDG = 'BIR11OsFizycznaDzialalnoscCeidg';
public const REPORT_PERSON_AGRO = 'BIR11OsFizycznaDzialalnoscRolnicza';
public const REPORT_PERSON_OTHER = 'BIR11OsFizycznaDzialalnoscPozostala';
public const REPORT_PERSON_DELETED_BEFORE_20141108 = 'BIR11OsFizycznaDzialalnoscSkreslonaDo20141108';
public const REPORT_PERSON_LOCALS = 'BIR11OsFizycznaListaJednLokalnych';
public const REPORT_PERSON_LOCAL = 'BIR11JednLokalnaOsFizycznej';
public const REPORT_PERSON_ACTIVITY = 'BIR11OsFizycznaPkd';
public const REPORT_PERSON_LOCAL_ACTIVITY = 'BIR11JednLokalnaOsFizycznejPkd';
public const REPORT_ORGANIZATION = 'BIR11OsPrawna';
public const REPORT_ORGANIZATION_ACTIVITY = 'BIR11OsPrawnaPkd';
public const REPORT_ORGANIZATION_LOCALS = 'BIR11OsPrawnaListaJednLokalnych';
public const REPORT_ORGANIZATION_LOCAL = 'BIR11JednLokalnaOsPrawnej';
public const REPORT_ORGANIZATION_LOCAL_ACTIVITY = 'BIR11JednLokalnaOsPrawnejPkd';
public const REPORT_ORGANIZATION_PARTNERS = 'BIR11OsPrawnaSpCywilnaWspolnicy';
public const REPORT_UNIT_TYPE = 'BIR11TypPodmiotu';

/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON" instead */
public const REPORT_ACTIVITY_PHYSIC_PERSON = self::REPORT_PERSON;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_CEIDG" instead */
public const REPORT_ACTIVITY_PHYSIC_CEIDG = self::REPORT_PERSON_CEIDG;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_AGRO" instead */
public const REPORT_ACTIVITY_PHYSIC_AGRO = self::REPORT_PERSON_AGRO;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_OTHER" instead */
public const REPORT_ACTIVITY_PHYSIC_OTHER_PUBLIC = self::REPORT_PERSON_OTHER;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_DELETED_BEFORE_20141108" instead */
public const REPORT_ACTIVITY_LOCAL_PHYSIC_WKR_PUBLIC = self::REPORT_PERSON_DELETED_BEFORE_20141108;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_LOCALS" instead */
public const REPORT_LOCALS_PHYSIC_PUBLIC = self::REPORT_PERSON_LOCALS;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_LOCAL" instead */
public const REPORT_LOCAL_PHYSIC_PUBLIC = self::REPORT_PERSON_LOCAL;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_ACTIVITY" instead */
public const REPORT_ACTIVITY_PHYSIC_PUBLIC = self::REPORT_PERSON_ACTIVITY;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_PERSON_LOCAL_ACTIVITY" instead */
public const REPORT_ACTIVITY_LOCAL_PHYSIC_PUBLIC = self::REPORT_PERSON_LOCAL_ACTIVITY;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_ORGANIZATION" instead */
public const REPORT_PUBLIC_LAW = self::REPORT_ORGANIZATION;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_ORGANIZATION_ACTIVITY" instead */
public const REPORT_ACTIVITY_LAW_PUBLIC = self::REPORT_ORGANIZATION_ACTIVITY;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_ORGANIZATION_LOCALS" instead */
public const REPORT_LOCALS_LAW_PUBLIC = self::REPORT_ORGANIZATION_LOCALS;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_ORGANIZATION_LOCAL" instead */
public const REPORT_LOCAL_LAW_PUBLIC = self::REPORT_ORGANIZATION_LOCAL;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_ORGANIZATION_LOCAL_ACTIVITY" instead */
public const REPORT_ACTIVITY_LOCAL_LAW_PUBLIC = self::REPORT_ORGANIZATION_LOCAL_ACTIVITY;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_ORGANIZATION_PARTNERS" instead */
public const REPORT_COMMON_LAW_PUBLIC = self::REPORT_ORGANIZATION_PARTNERS;
/** @deprecated deprecated since version 5.3 and will be removed in 6.0, use "REPORT_UNIT_TYPE" instead */
public const REPORT_UNIT_TYPE_PUBLIC = self::REPORT_UNIT_TYPE;

public const REPORTS = [
self::REPORT_ACTIVITY_PHYSIC_PERSON,
self::REPORT_ACTIVITY_PHYSIC_CEIDG,
self::REPORT_ACTIVITY_PHYSIC_AGRO,
self::REPORT_ACTIVITY_PHYSIC_OTHER_PUBLIC,
self::REPORT_ACTIVITY_LOCAL_PHYSIC_WKR_PUBLIC,
self::REPORT_LOCALS_PHYSIC_PUBLIC,
self::REPORT_LOCAL_PHYSIC_PUBLIC,
self::REPORT_ACTIVITY_PHYSIC_PUBLIC,
self::REPORT_ACTIVITY_LOCAL_PHYSIC_PUBLIC,
self::REPORT_PUBLIC_LAW,
self::REPORT_ACTIVITY_LAW_PUBLIC,
self::REPORT_LOCALS_LAW_PUBLIC,
self::REPORT_LOCAL_LAW_PUBLIC,
self::REPORT_ACTIVITY_LOCAL_LAW_PUBLIC,
self::REPORT_COMMON_LAW_PUBLIC,
self::REPORT_UNIT_TYPE_PUBLIC,
self::REPORT_PERSON,
self::REPORT_PERSON_CEIDG,
self::REPORT_PERSON_AGRO,
self::REPORT_PERSON_OTHER,
self::REPORT_PERSON_DELETED_BEFORE_20141108,
self::REPORT_PERSON_LOCALS,
self::REPORT_PERSON_LOCAL,
self::REPORT_PERSON_ACTIVITY,
self::REPORT_PERSON_LOCAL_ACTIVITY,
self::REPORT_ORGANIZATION,
self::REPORT_ORGANIZATION_ACTIVITY,
self::REPORT_ORGANIZATION_LOCALS,
self::REPORT_ORGANIZATION_LOCAL,
self::REPORT_ORGANIZATION_LOCAL_ACTIVITY,
self::REPORT_ORGANIZATION_PARTNERS,
self::REPORT_UNIT_TYPE,
];

public const REGON_9_REPORTS = [
self::REPORT_ACTIVITY_PHYSIC_PERSON,
self::REPORT_ACTIVITY_PHYSIC_CEIDG,
self::REPORT_ACTIVITY_PHYSIC_AGRO,
self::REPORT_ACTIVITY_PHYSIC_OTHER_PUBLIC,
self::REPORT_ACTIVITY_LOCAL_PHYSIC_WKR_PUBLIC,
self::REPORT_LOCALS_PHYSIC_PUBLIC,
self::REPORT_LOCAL_PHYSIC_PUBLIC,
self::REPORT_PUBLIC_LAW,
self::REPORT_ACTIVITY_LAW_PUBLIC,
self::REPORT_LOCALS_LAW_PUBLIC,
self::REPORT_COMMON_LAW_PUBLIC,
self::REPORT_PERSON,
self::REPORT_PERSON_CEIDG,
self::REPORT_PERSON_AGRO,
self::REPORT_PERSON_OTHER,
self::REPORT_PERSON_DELETED_BEFORE_20141108,
self::REPORT_PERSON_LOCALS,
self::REPORT_PERSON_LOCAL,
self::REPORT_ORGANIZATION,
self::REPORT_ORGANIZATION_ACTIVITY,
self::REPORT_ORGANIZATION_LOCALS,
self::REPORT_ORGANIZATION_PARTNERS,
];
}
2 changes: 1 addition & 1 deletion tests/GusApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function testGetFullReport(): void
;

$this->login();
$fullReport = $this->api->getFullReport($searchReport, ReportTypes::REPORT_PUBLIC_LAW);
$fullReport = $this->api->getFullReport($searchReport, ReportTypes::REPORT_ORGANIZATION);

$this->assertIsArray($fullReport);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/GusApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testGetFullReport(): void
{
$report = $this->createMock(SearchReport::class);
$report->method('getRegon')->willReturn('610188201');
$result = self::$apiClient->getFullReport($report, ReportTypes::REPORT_PUBLIC_LAW);
$result = self::$apiClient->getFullReport($report, ReportTypes::REPORT_ORGANIZATION);

$this->assertContainsOnly('array', $result);
$this->assertEquals('610188201', $result[0]['praw_regon9']);
Expand Down

0 comments on commit a9f777f

Please sign in to comment.