Новый файл helpers

This commit is contained in:
Anthony Axenov 2020-06-07 19:22:19 +08:00
parent c05e013a5a
commit 3ffab562f8
2 changed files with 19 additions and 0 deletions

View File

@ -46,6 +46,9 @@
"src/AtolOnline/Traits/", "src/AtolOnline/Traits/",
"src/AtolOnline/Constants/", "src/AtolOnline/Constants/",
"tests/" "tests/"
],
"files": [
"src/helpers.php"
] ]
} }
} }

16
src/helpers.php Normal file
View File

@ -0,0 +1,16 @@
<?php
if (!function_exists('valid_strlen')) {
/**
* Возвращает корректную длину строки
*
* @param string $value
* @return int
*/
function valid_strlen(string $value): int
{
return function_exists('mb_strlen')
? mb_strlen($value)
: strlen($value);
}
}