From b74f6521273457d4d573053d7731837341837490 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sun, 7 Jun 2020 19:26:33 +0800 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=20tr?= =?UTF-8?q?ait=20HasInn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Constraints::PATTERN_INN * phpdoc --- src/AtolOnline/Traits/HasInn.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AtolOnline/Traits/HasInn.php b/src/AtolOnline/Traits/HasInn.php index 933530e..856055a 100644 --- a/src/AtolOnline/Traits/HasInn.php +++ b/src/AtolOnline/Traits/HasInn.php @@ -9,6 +9,7 @@ namespace AtolOnline\Traits; +use AtolOnline\Constants\Constraints; use AtolOnline\Exceptions\AtolInnWrongLengthException; /** @@ -39,12 +40,12 @@ trait HasInn * * @param string $inn * @return $this - * @throws AtolInnWrongLengthException + * @throws AtolInnWrongLengthException Некорректная длина ИНН */ public function setInn(string $inn) { $inn = preg_replace("/[^0-9]/", '', $inn); - if (preg_match_all("/(^[0-9]{10}$)|(^[0-9]{12}$)/", $inn) == 0) { + if (preg_match_all(Constraints::PATTERN_INN, $inn) == 0) { throw new AtolInnWrongLengthException($inn); } $this->inn = $inn;