From ca32fe592326d72cf5dc88ba7a6ef4b34433038a Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Thu, 28 May 2020 22:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B2=D1=81=D1=8E=D0=B4=D1=83=20?= =?UTF-8?q?=D1=83=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D0=B0=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=20=D0=B4=D0=BB=D0=B8=D0=BD?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AtolOnline/Api/Kkt.php | 2 +- src/AtolOnline/Entities/Client.php | 4 ++-- src/AtolOnline/Entities/Company.php | 2 +- src/AtolOnline/Entities/Item.php | 4 ++-- src/AtolOnline/Traits/HasEmail.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AtolOnline/Api/Kkt.php b/src/AtolOnline/Api/Kkt.php index 979e464..ec2d872 100644 --- a/src/AtolOnline/Api/Kkt.php +++ b/src/AtolOnline/Api/Kkt.php @@ -118,7 +118,7 @@ class Kkt extends Client if (!$this->isTestMode()) { if (empty($login)) { throw new AtolKktLoginEmptyException(); - } elseif (strlen($login) > 100) { + } elseif ((function_exists('mb_strlen') ? mb_strlen($login) : strlen($login)) > 100) { throw new AtolKktLoginTooLongException($login, 100); } } diff --git a/src/AtolOnline/Entities/Client.php b/src/AtolOnline/Entities/Client.php index b57fc69..141b765 100644 --- a/src/AtolOnline/Entities/Client.php +++ b/src/AtolOnline/Entities/Client.php @@ -89,7 +89,7 @@ class Client extends Entity public function setName(string $name) { $name = trim($name); - if (strlen($name) > 256) { + if ((function_exists('mb_strlen') ? mb_strlen($name) : strlen($name)) > 256) { throw new AtolNameTooLongException($name, 256); } $this->name = $name; @@ -119,7 +119,7 @@ class Client extends Entity public function setPhone(string $phone) { $phone = preg_replace("/[^0-9+]/", '', $phone); - if (strlen($phone) > 64) { + if ((function_exists('mb_strlen') ? mb_strlen($phone) : strlen($phone)) > 64) { throw new AtolPhoneTooLongException($phone, 64); } $this->phone = $phone; diff --git a/src/AtolOnline/Entities/Company.php b/src/AtolOnline/Entities/Company.php index 900b036..289e706 100644 --- a/src/AtolOnline/Entities/Company.php +++ b/src/AtolOnline/Entities/Company.php @@ -115,7 +115,7 @@ class Company extends Entity public function setPaymentAddress(string $payment_address) { $payment_address = trim($payment_address); - if (strlen($payment_address) > 256) { + if ((function_exists('mb_strlen') ? mb_strlen($payment_address) : strlen($payment_address)) > 256) { throw new AtolPaymentAddressTooLongException($payment_address, 256); } $this->payment_address = $payment_address; diff --git a/src/AtolOnline/Entities/Item.php b/src/AtolOnline/Entities/Item.php index f421336..980659c 100644 --- a/src/AtolOnline/Entities/Item.php +++ b/src/AtolOnline/Entities/Item.php @@ -137,7 +137,7 @@ class Item extends Entity public function setName(string $name) { $name = trim($name); - if (strlen($name) > 128) { + if ((function_exists('mb_strlen') ? mb_strlen($name) : strlen($name)) > 128) { throw new AtolNameTooLongException($name, 128); } $this->name = $name; @@ -328,7 +328,7 @@ class Item extends Entity public function setUserData(string $user_data) { $user_data = trim($user_data); - if (strlen($user_data) > 64) { + if ((function_exists('mb_strlen') ? mb_strlen($user_data) : strlen($user_data)) > 64) { throw new AtolUserdataTooLongException($user_data, 64); } $this->user_data = $user_data; diff --git a/src/AtolOnline/Traits/HasEmail.php b/src/AtolOnline/Traits/HasEmail.php index 3aa5343..c65f211 100644 --- a/src/AtolOnline/Traits/HasEmail.php +++ b/src/AtolOnline/Traits/HasEmail.php @@ -44,7 +44,7 @@ trait HasEmail public function setEmail(string $email) { $email = trim($email); - if (strlen($email) > 64) { + if ((function_exists('mb_strlen') ? mb_strlen($email) : strlen($email)) > 64) { throw new AtolEmailTooLongException($email, 64); } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {