| 1 | <?php declare(strict_types = 1); |
||
| 7 | final class Alias |
||
| 8 | { |
||
| 9 | const TYPE_PHONE_NUMBER = 'PHONE_NUMBER'; |
||
| 10 | const TYPE_EMAIL = 'EMAIL'; |
||
| 11 | const TYPE_IBAN = 'IBAN'; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | private $type; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $value; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | private $name; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $type |
||
| 30 | * @param string $value |
||
| 31 | * @param string $name |
||
| 32 | */ |
||
| 33 | public function __construct(string $type, string $value, string $name) |
||
| 41 | |||
| 42 | public static function fromArray(array $alias) |
||
| 50 | |||
| 51 | public function toArray() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param string $type |
||
| 62 | * @return void |
||
| 63 | * @throws InvalidArgumentException |
||
| 64 | */ |
||
| 65 | private function guardValidType(string $type) |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | public function type(): string |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @return string |
||
| 87 | */ |
||
| 88 | public function value(): string |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @return string |
||
| 95 | */ |
||
| 96 | public function name(): string |
||
| 100 | } |
||
| 101 |