Conditions | 7 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function execute(AddressInterface $address): bool |
||
16 | { |
||
17 | if (!$this->getConfig()->isEnabledStreet() || empty($address->getStreet()) || !is_array($address->getStreet())) { |
||
18 | return true; |
||
19 | } |
||
20 | |||
21 | $pattern = $this->getConfig()->getStreetRegex(); |
||
22 | |||
23 | foreach ($address->getStreet() as $value) { |
||
24 | $value = (string)$value; |
||
25 | if ($value !== '' && $this->validate($value, $pattern, $this->getConfig()->getStreetStopwords()) === false) { |
||
26 | throw new LocalizedException(__($this->getConfig()->getStreetErrorMessage(), $value)); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | return true; |
||
31 | } |
||
33 |