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