1 | <?php |
||
14 | final class CreateAddressHandler |
||
15 | { |
||
16 | /** |
||
17 | * @var RepositoryInterface |
||
18 | */ |
||
19 | private $addressRepository; |
||
20 | |||
21 | /** |
||
22 | * @var FactoryInterface |
||
23 | */ |
||
24 | private $addressFactory; |
||
25 | |||
26 | /** |
||
27 | * @var RepositoryInterface |
||
28 | */ |
||
29 | private $countryRepository; |
||
30 | |||
31 | /** |
||
32 | * @var RepositoryInterface |
||
33 | */ |
||
34 | private $provinceRepository; |
||
35 | |||
36 | /** |
||
37 | * @var TokenStorageInterface |
||
38 | */ |
||
39 | private $tokenStorage; |
||
40 | |||
41 | /** |
||
42 | * CreateAddressHandler constructor. |
||
43 | * @param RepositoryInterface $addressRepository |
||
44 | * @param RepositoryInterface $countryRepository |
||
45 | * @param RepositoryInterface $provinceRepository |
||
46 | * @param FactoryInterface $addressFactory |
||
47 | * @param TokenStorageInterface $tokenStorage |
||
48 | */ |
||
49 | public function __construct( |
||
63 | |||
64 | public function handle(CreateAddress $command): void |
||
93 | |||
94 | /** |
||
95 | * @param string $countryCode |
||
96 | */ |
||
97 | private function assertCountryExists(string $countryCode): void |
||
101 | |||
102 | /** |
||
103 | * @param $province |
||
104 | */ |
||
105 | private function assertProvinceExists($province): void |
||
109 | |||
110 | /** |
||
111 | * @param string $provinceCode |
||
112 | * @return ProvinceInterface|object |
||
113 | */ |
||
114 | private function getProvince(string $provinceCode) |
||
118 | |||
119 | /** |
||
120 | * @param $user |
||
121 | */ |
||
122 | private function assertShopUserExists($user) |
||
126 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: