Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function execute(AddressInterface $address): bool |
||
16 | { |
||
17 | if (!$this->getConfig()->isEnabledLastname()) { |
||
18 | return true; |
||
19 | } |
||
20 | |||
21 | $value = (string)$address->getLastname(); |
||
22 | |||
23 | if ($value === '' || $this->validate($value, $this->getConfig()->getLastnameRegex(), $this->getConfig()->getLastnameStopwords())) { |
||
24 | return true; |
||
25 | } |
||
26 | |||
27 | throw new LocalizedException(__($this->getConfig()->getLastnameErrorMessage(), $address->getLastname())); |
||
28 | } |
||
30 |