From 6ebc0d1c32e1139d7ecd371eb8150b4061164882 Mon Sep 17 00:00:00 2001 From: Reindert Date: Thu, 6 Jul 2017 15:30:16 +0200 Subject: [PATCH] address error exception --- .../Repository/MyParcelConsignmentRepository.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Model/Repository/MyParcelConsignmentRepository.php b/src/Model/Repository/MyParcelConsignmentRepository.php index 2557b0fc..3fcb3e96 100755 --- a/src/Model/Repository/MyParcelConsignmentRepository.php +++ b/src/Model/Repository/MyParcelConsignmentRepository.php @@ -275,14 +275,14 @@ private function splitStreet($fullStreet) $result = preg_match(self::SPLIT_STREET_REGEX, $fullStreet, $matches); - if (!$result || !is_array($matches) || $fullStreet != $matches[0]) { - if ($fullStreet != $matches[0]) { - // Characters are gone by preg_match - throw new \Exception('Something went wrong with splitting up address ' . $fullStreet); - } else { - // Invalid full street supplied - throw new \Exception('Invalid full street supplied: ' . $fullStreet); - } + if (!$result || !is_array($matches)) { + // Invalid full street supplied + throw new \Exception('Invalid full street supplied: ' . $fullStreet); + } + + if ($fullStreet != $matches[0]) { + // Characters are gone by preg_match + throw new \Exception('Something went wrong with splitting up address ' . $fullStreet); } if (isset($matches['street'])) {