MarioBlazek /
easy-pdf-cloud
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Bcl\EasyPdfCloud; |
||
| 6 | |||
| 7 | use function mb_strlen; |
||
| 8 | |||
| 9 | class StringUtils |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Returns length of multibyte string |
||
| 13 | * |
||
| 14 | * @param string $string |
||
| 15 | * @param string $encoding |
||
| 16 | * |
||
| 17 | * @return int |
||
| 18 | */ |
||
| 19 | public static function length(string $string, string $encoding = Constraints::UTF_8): int |
||
| 20 | { |
||
| 21 | return mb_strlen($string, $encoding); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Checks if multibyte string is empty |
||
| 26 | * |
||
| 27 | * @param string $string |
||
| 28 | * @param string $encoding |
||
| 29 | * |
||
| 30 | * @return bool |
||
| 31 | */ |
||
| 32 | public static function isEmpty(string $string, string $encoding = Constraints::UTF_8): bool |
||
|
0 ignored issues
–
show
|
|||
| 33 | { |
||
| 34 | return 0 === self::length($string, $encoding = Constraints::UTF_8); |
||
| 35 | } |
||
| 36 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.