mirror of
https://github.com/anthonyaxenov/atol-online.git
synced 2024-11-22 15:04:33 +00:00
Повсюду улучшена проверка длин строк
This commit is contained in:
parent
9ea1c81666
commit
ca32fe5923
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user