feat: used parser output to recreate the DTOs

This commit is contained in:
2024-08-15 03:57:04 +03:00
parent 15a4593345
commit 8089a5c0dd
11 changed files with 243 additions and 329 deletions

View File

@@ -12,32 +12,26 @@ class BisCompanyRegisteredEntry extends DataTransferObject
{
/**
* Description of entry
*
* @var string
*/
public string $description;
public string $description = "";
/**
* Zero for common entries, one for Unregistered and two for Registered
*
* @see getStatusText()
*
* @var int
*/
public int $status;
/**
* Date of registration
*
* @var string
*/
public string $registrationDate;
public string $registrationDate = "";
/**
* Ending date of registration
*
* @var string|null
*/
public ?string $endDate;
public ?string $endDate = null;
/**
* register (integer):
* register (int):
* - One for Trade Register,
* - two for Register of Foundations,
* - three for Register of Associations,
@@ -48,18 +42,14 @@ class BisCompanyRegisteredEntry extends DataTransferObject
* - eight for register of bodies liable for tax on insurance premiums
*
* @see getRegisterText()
*
* @var int
*/
public int $register;
/**
* Two letter language code
*
* @var string|null
*/
public ?string $language;
/**
* authority (integer):
* authority (int):
* - One for Tax Administration,
* - two for Finnish Patent and Registration Office and
* - three for Population Register
@@ -74,35 +64,35 @@ class BisCompanyRegisteredEntry extends DataTransferObject
{
// Zero for common entries, one for Unregistered and two for Registered
return match ($this->status) {
0 => 'Common',
1 => 'Unregistered',
2 => 'Registered',
default => throw new UnexpectedValueException('Unexpected value: ' . $this->status)
0 => "Common",
1 => "Unregistered",
2 => "Registered",
default => throw new UnexpectedValueException("Unexpected value: " . $this->status),
};
}
public function getRegisterText(): string
{
return match ($this->register) {
1 => 'Trade Register',
2 => 'Register of Foundations',
3 => 'Register of Associations',
4 => 'Tax Administration',
5 => 'Prepayment Register',
6 => 'VAT Register',
7 => 'Employer Register',
8 => 'register of bodies liable for tax on insurance premiums',
default => throw new UnexpectedValueException('Unexpected value: ' . $this->register),
1 => "Trade Register",
2 => "Register of Foundations",
3 => "Register of Associations",
4 => "Tax Administration",
5 => "Prepayment Register",
6 => "VAT Register",
7 => "Employer Register",
8 => "register of bodies liable for tax on insurance premiums",
default => throw new UnexpectedValueException("Unexpected value: " . $this->register),
};
}
public function getAuthorityText(): string
{
return match ($this->authority) {
1 => 'Tax Administration',
2 => 'Finnish Patent and Registration Office',
3 => 'Population Register',
default => throw new UnexpectedValueException('Unexpected value: ' . $this->authority),
1 => "Tax Administration",
2 => "Finnish Patent and Registration Office",
3 => "Population Register",
default => throw new UnexpectedValueException("Unexpected value: " . $this->authority),
};
}
}