diff --git a/src/Client/DaDataCompany.php b/src/Client/DaDataCompany.php new file mode 100644 index 0000000..1887736 --- /dev/null +++ b/src/Client/DaDataCompany.php @@ -0,0 +1,11 @@ + 'BANK', - self::NKO => 'NKO', - self::BANK_BRANCH => 'BANK_BRANCH', - self::NKO_BRANCH => 'NKO_BRANCH', - self::RKC => 'RKC', - self::OTHER => 'OTHER', - ]; +enum BankType:string +{ + use Enum; + const BANK = 'BANK'; + const NKO = 'NKO'; + const BANK_BRANCH = 'BANK_BRANCH'; + const NKO_BRANCH = 'NKO_BRANCH'; + const RKC = 'RKC'; + const OTHER = 'OTHER'; } diff --git a/src/Enums/BranchType.php b/src/Enums/BranchType.php index 8d7aed2..d884aff 100644 --- a/src/Enums/BranchType.php +++ b/src/Enums/BranchType.php @@ -2,22 +2,16 @@ namespace MoveMoveIo\DaData\Enums; +use MoveMoveIo\DaData\Helpers\Enum; + /** * Class BranchType * @package MoveMoveIo\DaData\Enums */ -class BranchType +enum BranchType:string { + use Enum; - const MAIN = 1; - const BRANCH = 2; - - /** - * @var string[] - */ - public static $map = [ - self::MAIN => 'MAIN', - self::BRANCH => 'BRANCH', - ]; - + const MAIN = 'MAIN'; + const BRANCH = 'BRANCH'; } diff --git a/src/Enums/CompanyScope.php b/src/Enums/CompanyScope.php index 86db851..7399097 100644 --- a/src/Enums/CompanyScope.php +++ b/src/Enums/CompanyScope.php @@ -2,22 +2,9 @@ namespace MoveMoveIo\DaData\Enums; -/** - * Class CompanyScope - * @package MoveMoveIo\DaData\Enums - */ -class CompanyScope +enum CompanyScope:string { - const FOUNDERS = 1; - const MANAGERS = 2; - - /** - * @var string[] - */ - public static $map = [ - self::FOUNDERS => 'FOUNDERS', - self::MANAGERS => 'MANAGERS', - ]; - + const FOUNDERS = 'FOUNDERS'; + const MANAGERS = 'MANAGERS'; } diff --git a/src/Enums/CompanyStatus.php b/src/Enums/CompanyStatus.php index 1c78872..4868c99 100644 --- a/src/Enums/CompanyStatus.php +++ b/src/Enums/CompanyStatus.php @@ -2,23 +2,13 @@ namespace MoveMoveIo\DaData\Enums; -/** - * Class CompanyStatus - */ -class CompanyStatus -{ - - const ACTIVE = 1; - const LIQUIDATING = 2; - const LIQUIDATED = 3; +use MoveMoveIo\DaData\Helpers\Enum; - /** - * @var string[] - */ - public static $map = [ - self::ACTIVE => 'ACTIVE', - self::LIQUIDATING => 'LIQUIDATING', - self::LIQUIDATED => 'LIQUIDATED', - ]; +enum CompanyStatus:string +{ + use Enum; + const ACTIVE = 'ACTIVE'; + const LIQUIDATING = 'LIQUIDATING'; + const LIQUIDATED = 'LIQUIDATED'; } diff --git a/src/Enums/CompanyType.php b/src/Enums/CompanyType.php index a77a3f6..8f69e41 100644 --- a/src/Enums/CompanyType.php +++ b/src/Enums/CompanyType.php @@ -2,21 +2,12 @@ namespace MoveMoveIo\DaData\Enums; -/** - * Class CompanyType - */ -class CompanyType -{ - - const LEGAL = 0; - const INDIVIDUAL = 1; +use MoveMoveIo\DaData\Helpers\Enum; - /** - * @var string[] - */ - public static $map = [ - self::LEGAL => 'LEGAL', - self::INDIVIDUAL => 'INDIVIDUAL', - ]; +enum CompanyType:string +{ + use Enum; + case LEGAL = 'LEGAL'; + case INDIVIDUAL = 'INDIVIDUAL'; } diff --git a/src/Enums/Gender.php b/src/Enums/Gender.php index 6af1260..06fc584 100644 --- a/src/Enums/Gender.php +++ b/src/Enums/Gender.php @@ -2,20 +2,13 @@ namespace MoveMoveIo\DaData\Enums; -/** - * Class Gender - * @package MoveMoveIo\DaData\Enums - */ -class Gender -{ - const UNKNOWN = 0; - const MALE = 1; - const FEMALE = 2; - - public static $map = [ - self::UNKNOWN => 'UNKNOWN', - self::MALE => 'MALE', - self::FEMALE => 'FEMALE', - ]; +use MoveMoveIo\DaData\Helpers\Enum; +enum Gender:string +{ + use Enum; + + const UNKNOWN = 'UNKNOWN'; + const MALE = 'MALE'; + const FEMALE = 'FEMALE'; } diff --git a/src/Enums/Language.php b/src/Enums/Language.php index 699c5c0..15abfc6 100644 --- a/src/Enums/Language.php +++ b/src/Enums/Language.php @@ -2,19 +2,12 @@ namespace MoveMoveIo\DaData\Enums; -/** - * Class Language - * @package MoveMoveIo\DaData\Enums - */ -class Language -{ - - const RU = 1; - const EN = 2; +use MoveMoveIo\DaData\Helpers\Enum; - public static $map = [ - self::RU => 'ru', - self::EN => 'en', - ]; +enum Language:string +{ + use Enum; + const RU = 'RU'; + const EN = 'EN'; } diff --git a/src/Enums/Parts.php b/src/Enums/Parts.php index a93af09..e57775e 100644 --- a/src/Enums/Parts.php +++ b/src/Enums/Parts.php @@ -2,20 +2,9 @@ namespace MoveMoveIo\DaData\Enums; -/** - * Class Parts - * @package MoveMoveIo\DaData\Enums - */ -class Parts +enum Parts:string { - const NAME = 0; - const SURNAME = 1; - const PATRONYMIC = 2; - - public static $map = [ - self::NAME => 'NAME', - self::SURNAME => 'SURNAME', - self::PATRONYMIC => 'PATRONYMIC', - ]; - + const NAME = 'NAME'; + const SURNAME = 'SURNAME'; + const PATRONYMIC = 'PATRONYMIC'; } diff --git a/src/Helpers/Enum.php b/src/Helpers/Enum.php new file mode 100644 index 0000000..98f92d1 --- /dev/null +++ b/src/Helpers/Enum.php @@ -0,0 +1,23 @@ +value; + } + + return $values; + } +}