1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| <?php
|
| namespace PhpZip\Util;
|
| /**
| * String Util.
| *
| * @internal
| */
| final class StringUtil
| {
| /**
| * @param string $haystack
| * @param string $needle
| *
| * @return bool
| */
| public static function endsWith($haystack, $needle)
| {
| $length = \strlen($needle);
|
| if ($length === 0) {
| return true;
| }
|
| return substr($haystack, -$length) === $needle;
| }
|
| /**
| * @param string $string
| *
| * @return bool
| */
| public static function isBinary($string)
| {
| return strpos($string, "\0") !== false;
| }
|
| /**
| * @param string $name
| *
| * @return bool
| */
| public static function isASCII($name)
| {
| return preg_match('~[^\x20-\x7e]~', (string) $name) === 0;
| }
| }
|
|