@@ -20,48 +20,48 @@ |
||
20 | 20 | */ |
21 | 21 | class SingleCommandApplication extends Command |
22 | 22 | { |
23 | - private $version = 'UNKNOWN'; |
|
24 | - private $autoExit = true; |
|
25 | - private $running = false; |
|
23 | + private $version = 'UNKNOWN'; |
|
24 | + private $autoExit = true; |
|
25 | + private $running = false; |
|
26 | 26 | |
27 | - public function setVersion(string $version): self |
|
28 | - { |
|
29 | - $this->version = $version; |
|
27 | + public function setVersion(string $version): self |
|
28 | + { |
|
29 | + $this->version = $version; |
|
30 | 30 | |
31 | - return $this; |
|
32 | - } |
|
31 | + return $this; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @final |
|
36 | - */ |
|
37 | - public function setAutoExit(bool $autoExit): self |
|
38 | - { |
|
39 | - $this->autoExit = $autoExit; |
|
34 | + /** |
|
35 | + * @final |
|
36 | + */ |
|
37 | + public function setAutoExit(bool $autoExit): self |
|
38 | + { |
|
39 | + $this->autoExit = $autoExit; |
|
40 | 40 | |
41 | - return $this; |
|
42 | - } |
|
41 | + return $this; |
|
42 | + } |
|
43 | 43 | |
44 | - public function run(InputInterface $input = null, OutputInterface $output = null): int |
|
45 | - { |
|
46 | - if ($this->running) { |
|
47 | - return parent::run($input, $output); |
|
48 | - } |
|
44 | + public function run(InputInterface $input = null, OutputInterface $output = null): int |
|
45 | + { |
|
46 | + if ($this->running) { |
|
47 | + return parent::run($input, $output); |
|
48 | + } |
|
49 | 49 | |
50 | - // We use the command name as the application name |
|
51 | - $application = new Application($this->getName() ?: 'UNKNOWN', $this->version); |
|
52 | - $application->setAutoExit($this->autoExit); |
|
53 | - // Fix the usage of the command displayed with "--help" |
|
54 | - $this->setName($_SERVER['argv'][0]); |
|
55 | - $application->add($this); |
|
56 | - $application->setDefaultCommand($this->getName(), true); |
|
50 | + // We use the command name as the application name |
|
51 | + $application = new Application($this->getName() ?: 'UNKNOWN', $this->version); |
|
52 | + $application->setAutoExit($this->autoExit); |
|
53 | + // Fix the usage of the command displayed with "--help" |
|
54 | + $this->setName($_SERVER['argv'][0]); |
|
55 | + $application->add($this); |
|
56 | + $application->setDefaultCommand($this->getName(), true); |
|
57 | 57 | |
58 | - $this->running = true; |
|
59 | - try { |
|
60 | - $ret = $application->run($input, $output); |
|
61 | - } finally { |
|
62 | - $this->running = false; |
|
63 | - } |
|
58 | + $this->running = true; |
|
59 | + try { |
|
60 | + $ret = $application->run($input, $output); |
|
61 | + } finally { |
|
62 | + $this->running = false; |
|
63 | + } |
|
64 | 64 | |
65 | - return $ret ?? 1; |
|
66 | - } |
|
65 | + return $ret ?? 1; |
|
66 | + } |
|
67 | 67 | } |
@@ -28,553 +28,553 @@ |
||
28 | 28 | */ |
29 | 29 | abstract class AbstractUnicodeString extends AbstractString |
30 | 30 | { |
31 | - public const NFC = \Normalizer::NFC; |
|
32 | - public const NFD = \Normalizer::NFD; |
|
33 | - public const NFKC = \Normalizer::NFKC; |
|
34 | - public const NFKD = \Normalizer::NFKD; |
|
35 | - |
|
36 | - // all ASCII letters sorted by typical frequency of occurrence |
|
37 | - private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
|
38 | - |
|
39 | - // the subset of folded case mappings that is not in lower case mappings |
|
40 | - private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ']; |
|
41 | - private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ']; |
|
42 | - |
|
43 | - // the subset of upper case mappings that map one code point to many code points |
|
44 | - private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ']; |
|
45 | - private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ́', 'Ϋ́', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓́', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ́', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ́', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂']; |
|
46 | - |
|
47 | - // the subset of https://github.com/unicode-org/cldr/blob/master/common/transforms/Latin-ASCII.xml that is not in NFKD |
|
48 | - private const TRANSLIT_FROM = ['Æ', 'Ð', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', 'Đ', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', 'Ɓ', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', 'Ɛ', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', 'Ɲ', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', 'ɍ', 'Ɏ', 'ɏ', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', 'ʏ', 'ʐ', 'ʑ', 'ʙ', 'ʛ', 'ʜ', 'ʝ', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', 'ᴁ', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', 'ᴍ', 'ᴏ', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', 'ᶁ', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', 'ᶍ', 'ᶎ', 'ᶏ', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', 'ẝ', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '㏆', '㏗', '㏞', '㏟', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '⅝', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '′', '″', '〝', '〞', '«', '»', '‹', '›', '‐', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '⁄', '⁅', '⁆', '⁎', '、', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '﹝', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆']; |
|
49 | - private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))']; |
|
50 | - |
|
51 | - private static $transliterators = []; |
|
52 | - |
|
53 | - /** |
|
54 | - * @return static |
|
55 | - */ |
|
56 | - public static function fromCodePoints(int ...$codes): self |
|
57 | - { |
|
58 | - $string = ''; |
|
59 | - |
|
60 | - foreach ($codes as $code) { |
|
61 | - if (0x80 > $code %= 0x200000) { |
|
62 | - $string .= \chr($code); |
|
63 | - } elseif (0x800 > $code) { |
|
64 | - $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); |
|
65 | - } elseif (0x10000 > $code) { |
|
66 | - $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
67 | - } else { |
|
68 | - $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
69 | - } |
|
70 | - } |
|
71 | - |
|
72 | - return new static($string); |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * Generic UTF-8 to ASCII transliteration. |
|
77 | - * |
|
78 | - * Install the intl extension for best results. |
|
79 | - * |
|
80 | - * @param string[]|\Transliterator[]|\Closure[] $rules See "*-Latin" rules from Transliterator::listIDs() |
|
81 | - */ |
|
82 | - public function ascii(array $rules = []): self |
|
83 | - { |
|
84 | - $str = clone $this; |
|
85 | - $s = $str->string; |
|
86 | - $str->string = ''; |
|
87 | - |
|
88 | - array_unshift($rules, 'nfd'); |
|
89 | - $rules[] = 'latin-ascii'; |
|
90 | - |
|
91 | - if (\function_exists('transliterator_transliterate')) { |
|
92 | - $rules[] = 'any-latin/bgn'; |
|
93 | - } |
|
94 | - |
|
95 | - $rules[] = 'nfkd'; |
|
96 | - $rules[] = '[:nonspacing mark:] remove'; |
|
97 | - |
|
98 | - while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) { |
|
99 | - if (0 < --$i) { |
|
100 | - $str->string .= substr($s, 0, $i); |
|
101 | - $s = substr($s, $i); |
|
102 | - } |
|
103 | - |
|
104 | - if (!$rule = array_shift($rules)) { |
|
105 | - $rules = []; // An empty rule interrupts the next ones |
|
106 | - } |
|
107 | - |
|
108 | - if ($rule instanceof \Transliterator) { |
|
109 | - $s = $rule->transliterate($s); |
|
110 | - } elseif ($rule instanceof \Closure) { |
|
111 | - $s = $rule($s); |
|
112 | - } elseif ($rule) { |
|
113 | - if ('nfd' === $rule = strtolower($rule)) { |
|
114 | - normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD); |
|
115 | - } elseif ('nfkd' === $rule) { |
|
116 | - normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD); |
|
117 | - } elseif ('[:nonspacing mark:] remove' === $rule) { |
|
118 | - $s = preg_replace('/\p{Mn}++/u', '', $s); |
|
119 | - } elseif ('latin-ascii' === $rule) { |
|
120 | - $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s); |
|
121 | - } elseif ('de-ascii' === $rule) { |
|
122 | - $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s); |
|
123 | - $s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s); |
|
124 | - } elseif (\function_exists('transliterator_transliterate')) { |
|
125 | - if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) { |
|
126 | - if ('any-latin/bgn' === $rule) { |
|
127 | - $rule = 'any-latin'; |
|
128 | - $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule); |
|
129 | - } |
|
130 | - |
|
131 | - if (null === $transliterator) { |
|
132 | - throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule)); |
|
133 | - } |
|
134 | - |
|
135 | - self::$transliterators['any-latin/bgn'] = $transliterator; |
|
136 | - } |
|
137 | - |
|
138 | - $s = $transliterator->transliterate($s); |
|
139 | - } |
|
140 | - } elseif (!\function_exists('iconv')) { |
|
141 | - $s = preg_replace('/[^\x00-\x7F]/u', '?', $s); |
|
142 | - } else { |
|
143 | - $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) { |
|
144 | - $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]); |
|
145 | - |
|
146 | - if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) { |
|
147 | - throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class)); |
|
148 | - } |
|
149 | - |
|
150 | - return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?'); |
|
151 | - }, $s); |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - $str->string .= $s; |
|
156 | - |
|
157 | - return $str; |
|
158 | - } |
|
159 | - |
|
160 | - public function camel(): parent |
|
161 | - { |
|
162 | - $str = clone $this; |
|
163 | - $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function ($m) use (&$i) { |
|
164 | - return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); |
|
165 | - }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string))); |
|
166 | - |
|
167 | - return $str; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @return int[] |
|
172 | - */ |
|
173 | - public function codePointsAt(int $offset): array |
|
174 | - { |
|
175 | - $str = $this->slice($offset, 1); |
|
176 | - |
|
177 | - if ('' === $str->string) { |
|
178 | - return []; |
|
179 | - } |
|
180 | - |
|
181 | - $codePoints = []; |
|
182 | - |
|
183 | - foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) { |
|
184 | - $codePoints[] = mb_ord($c, 'UTF-8'); |
|
185 | - } |
|
186 | - |
|
187 | - return $codePoints; |
|
188 | - } |
|
189 | - |
|
190 | - public function folded(bool $compat = true): parent |
|
191 | - { |
|
192 | - $str = clone $this; |
|
193 | - |
|
194 | - if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) { |
|
195 | - $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC); |
|
196 | - $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8'); |
|
197 | - } else { |
|
198 | - $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF); |
|
199 | - } |
|
200 | - |
|
201 | - return $str; |
|
202 | - } |
|
203 | - |
|
204 | - public function join(array $strings, string $lastGlue = null): parent |
|
205 | - { |
|
206 | - $str = clone $this; |
|
207 | - |
|
208 | - $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : ''; |
|
209 | - $str->string = implode($this->string, $strings).$tail; |
|
210 | - |
|
211 | - if (!preg_match('//u', $str->string)) { |
|
212 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
213 | - } |
|
214 | - |
|
215 | - return $str; |
|
216 | - } |
|
217 | - |
|
218 | - public function lower(): parent |
|
219 | - { |
|
220 | - $str = clone $this; |
|
221 | - $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8'); |
|
222 | - |
|
223 | - return $str; |
|
224 | - } |
|
225 | - |
|
226 | - public function match(string $regexp, int $flags = 0, int $offset = 0): array |
|
227 | - { |
|
228 | - $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match'; |
|
229 | - |
|
230 | - if ($this->ignoreCase) { |
|
231 | - $regexp .= 'i'; |
|
232 | - } |
|
233 | - |
|
234 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
235 | - |
|
236 | - try { |
|
237 | - if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) { |
|
238 | - $lastError = preg_last_error(); |
|
239 | - |
|
240 | - foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
|
241 | - if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
|
242 | - throw new RuntimeException('Matching failed with '.$k.'.'); |
|
243 | - } |
|
244 | - } |
|
245 | - |
|
246 | - throw new RuntimeException('Matching failed with unknown error code.'); |
|
247 | - } |
|
248 | - } finally { |
|
249 | - restore_error_handler(); |
|
250 | - } |
|
251 | - |
|
252 | - return $matches; |
|
253 | - } |
|
254 | - |
|
255 | - /** |
|
256 | - * @return static |
|
257 | - */ |
|
258 | - public function normalize(int $form = self::NFC): self |
|
259 | - { |
|
260 | - if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) { |
|
261 | - throw new InvalidArgumentException('Unsupported normalization form.'); |
|
262 | - } |
|
263 | - |
|
264 | - $str = clone $this; |
|
265 | - normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form); |
|
266 | - |
|
267 | - return $str; |
|
268 | - } |
|
269 | - |
|
270 | - public function padBoth(int $length, string $padStr = ' '): parent |
|
271 | - { |
|
272 | - if ('' === $padStr || !preg_match('//u', $padStr)) { |
|
273 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
274 | - } |
|
275 | - |
|
276 | - $pad = clone $this; |
|
277 | - $pad->string = $padStr; |
|
278 | - |
|
279 | - return $this->pad($length, $pad, \STR_PAD_BOTH); |
|
280 | - } |
|
281 | - |
|
282 | - public function padEnd(int $length, string $padStr = ' '): parent |
|
283 | - { |
|
284 | - if ('' === $padStr || !preg_match('//u', $padStr)) { |
|
285 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
286 | - } |
|
287 | - |
|
288 | - $pad = clone $this; |
|
289 | - $pad->string = $padStr; |
|
290 | - |
|
291 | - return $this->pad($length, $pad, \STR_PAD_RIGHT); |
|
292 | - } |
|
293 | - |
|
294 | - public function padStart(int $length, string $padStr = ' '): parent |
|
295 | - { |
|
296 | - if ('' === $padStr || !preg_match('//u', $padStr)) { |
|
297 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
298 | - } |
|
299 | - |
|
300 | - $pad = clone $this; |
|
301 | - $pad->string = $padStr; |
|
302 | - |
|
303 | - return $this->pad($length, $pad, \STR_PAD_LEFT); |
|
304 | - } |
|
305 | - |
|
306 | - public function replaceMatches(string $fromRegexp, $to): parent |
|
307 | - { |
|
308 | - if ($this->ignoreCase) { |
|
309 | - $fromRegexp .= 'i'; |
|
310 | - } |
|
311 | - |
|
312 | - if (\is_array($to) || $to instanceof \Closure) { |
|
313 | - if (!\is_callable($to)) { |
|
314 | - throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class)); |
|
315 | - } |
|
316 | - |
|
317 | - $replace = 'preg_replace_callback'; |
|
318 | - $to = static function (array $m) use ($to): string { |
|
319 | - $to = $to($m); |
|
320 | - |
|
321 | - if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) { |
|
322 | - throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.'); |
|
323 | - } |
|
324 | - |
|
325 | - return $to; |
|
326 | - }; |
|
327 | - } elseif ('' !== $to && !preg_match('//u', $to)) { |
|
328 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
329 | - } else { |
|
330 | - $replace = 'preg_replace'; |
|
331 | - } |
|
332 | - |
|
333 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
334 | - |
|
335 | - try { |
|
336 | - if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) { |
|
337 | - $lastError = preg_last_error(); |
|
338 | - |
|
339 | - foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
|
340 | - if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
|
341 | - throw new RuntimeException('Matching failed with '.$k.'.'); |
|
342 | - } |
|
343 | - } |
|
344 | - |
|
345 | - throw new RuntimeException('Matching failed with unknown error code.'); |
|
346 | - } |
|
347 | - } finally { |
|
348 | - restore_error_handler(); |
|
349 | - } |
|
350 | - |
|
351 | - $str = clone $this; |
|
352 | - $str->string = $string; |
|
353 | - |
|
354 | - return $str; |
|
355 | - } |
|
356 | - |
|
357 | - public function reverse(): parent |
|
358 | - { |
|
359 | - $str = clone $this; |
|
360 | - $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY))); |
|
361 | - |
|
362 | - return $str; |
|
363 | - } |
|
364 | - |
|
365 | - public function snake(): parent |
|
366 | - { |
|
367 | - $str = $this->camel()->title(); |
|
368 | - $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8'); |
|
369 | - |
|
370 | - return $str; |
|
371 | - } |
|
372 | - |
|
373 | - public function title(bool $allWords = false): parent |
|
374 | - { |
|
375 | - $str = clone $this; |
|
376 | - |
|
377 | - $limit = $allWords ? -1 : 1; |
|
378 | - |
|
379 | - $str->string = preg_replace_callback('/\b./u', static function (array $m): string { |
|
380 | - return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); |
|
381 | - }, $str->string, $limit); |
|
382 | - |
|
383 | - return $str; |
|
384 | - } |
|
385 | - |
|
386 | - public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent |
|
387 | - { |
|
388 | - if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) { |
|
389 | - throw new InvalidArgumentException('Invalid UTF-8 chars.'); |
|
390 | - } |
|
391 | - $chars = preg_quote($chars); |
|
392 | - |
|
393 | - $str = clone $this; |
|
394 | - $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string); |
|
395 | - |
|
396 | - return $str; |
|
397 | - } |
|
398 | - |
|
399 | - public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent |
|
400 | - { |
|
401 | - if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) { |
|
402 | - throw new InvalidArgumentException('Invalid UTF-8 chars.'); |
|
403 | - } |
|
404 | - $chars = preg_quote($chars); |
|
405 | - |
|
406 | - $str = clone $this; |
|
407 | - $str->string = preg_replace("{[$chars]++$}uD", '', $str->string); |
|
408 | - |
|
409 | - return $str; |
|
410 | - } |
|
411 | - |
|
412 | - public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent |
|
413 | - { |
|
414 | - if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) { |
|
415 | - throw new InvalidArgumentException('Invalid UTF-8 chars.'); |
|
416 | - } |
|
417 | - $chars = preg_quote($chars); |
|
418 | - |
|
419 | - $str = clone $this; |
|
420 | - $str->string = preg_replace("{^[$chars]++}uD", '', $str->string); |
|
421 | - |
|
422 | - return $str; |
|
423 | - } |
|
424 | - |
|
425 | - public function upper(): parent |
|
426 | - { |
|
427 | - $str = clone $this; |
|
428 | - $str->string = mb_strtoupper($str->string, 'UTF-8'); |
|
429 | - |
|
430 | - if (\PHP_VERSION_ID < 70300) { |
|
431 | - $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string); |
|
432 | - } |
|
433 | - |
|
434 | - return $str; |
|
435 | - } |
|
436 | - |
|
437 | - public function width(bool $ignoreAnsiDecoration = true): int |
|
438 | - { |
|
439 | - $width = 0; |
|
440 | - $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string); |
|
441 | - |
|
442 | - if (false !== strpos($s, "\r")) { |
|
443 | - $s = str_replace(["\r\n", "\r"], "\n", $s); |
|
444 | - } |
|
445 | - |
|
446 | - if (!$ignoreAnsiDecoration) { |
|
447 | - $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s); |
|
448 | - } |
|
31 | + public const NFC = \Normalizer::NFC; |
|
32 | + public const NFD = \Normalizer::NFD; |
|
33 | + public const NFKC = \Normalizer::NFKC; |
|
34 | + public const NFKD = \Normalizer::NFKD; |
|
35 | + |
|
36 | + // all ASCII letters sorted by typical frequency of occurrence |
|
37 | + private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; |
|
38 | + |
|
39 | + // the subset of folded case mappings that is not in lower case mappings |
|
40 | + private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ']; |
|
41 | + private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ']; |
|
42 | + |
|
43 | + // the subset of upper case mappings that map one code point to many code points |
|
44 | + private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ']; |
|
45 | + private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ́', 'Ϋ́', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓́', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ́', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ́', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂']; |
|
46 | + |
|
47 | + // the subset of https://github.com/unicode-org/cldr/blob/master/common/transforms/Latin-ASCII.xml that is not in NFKD |
|
48 | + private const TRANSLIT_FROM = ['Æ', 'Ð', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', 'Đ', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', 'Ɓ', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', 'Ɛ', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', 'Ɲ', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', 'ɍ', 'Ɏ', 'ɏ', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', 'ʏ', 'ʐ', 'ʑ', 'ʙ', 'ʛ', 'ʜ', 'ʝ', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', 'ᴁ', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', 'ᴍ', 'ᴏ', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', 'ᶁ', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', 'ᶍ', 'ᶎ', 'ᶏ', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', 'ẝ', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '㏆', '㏗', '㏞', '㏟', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '⅝', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '′', '″', '〝', '〞', '«', '»', '‹', '›', '‐', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '⁄', '⁅', '⁆', '⁎', '、', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '﹝', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆']; |
|
49 | + private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))']; |
|
50 | + |
|
51 | + private static $transliterators = []; |
|
52 | + |
|
53 | + /** |
|
54 | + * @return static |
|
55 | + */ |
|
56 | + public static function fromCodePoints(int ...$codes): self |
|
57 | + { |
|
58 | + $string = ''; |
|
59 | + |
|
60 | + foreach ($codes as $code) { |
|
61 | + if (0x80 > $code %= 0x200000) { |
|
62 | + $string .= \chr($code); |
|
63 | + } elseif (0x800 > $code) { |
|
64 | + $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); |
|
65 | + } elseif (0x10000 > $code) { |
|
66 | + $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
67 | + } else { |
|
68 | + $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
69 | + } |
|
70 | + } |
|
71 | + |
|
72 | + return new static($string); |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * Generic UTF-8 to ASCII transliteration. |
|
77 | + * |
|
78 | + * Install the intl extension for best results. |
|
79 | + * |
|
80 | + * @param string[]|\Transliterator[]|\Closure[] $rules See "*-Latin" rules from Transliterator::listIDs() |
|
81 | + */ |
|
82 | + public function ascii(array $rules = []): self |
|
83 | + { |
|
84 | + $str = clone $this; |
|
85 | + $s = $str->string; |
|
86 | + $str->string = ''; |
|
87 | + |
|
88 | + array_unshift($rules, 'nfd'); |
|
89 | + $rules[] = 'latin-ascii'; |
|
90 | + |
|
91 | + if (\function_exists('transliterator_transliterate')) { |
|
92 | + $rules[] = 'any-latin/bgn'; |
|
93 | + } |
|
94 | + |
|
95 | + $rules[] = 'nfkd'; |
|
96 | + $rules[] = '[:nonspacing mark:] remove'; |
|
97 | + |
|
98 | + while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) { |
|
99 | + if (0 < --$i) { |
|
100 | + $str->string .= substr($s, 0, $i); |
|
101 | + $s = substr($s, $i); |
|
102 | + } |
|
103 | + |
|
104 | + if (!$rule = array_shift($rules)) { |
|
105 | + $rules = []; // An empty rule interrupts the next ones |
|
106 | + } |
|
107 | + |
|
108 | + if ($rule instanceof \Transliterator) { |
|
109 | + $s = $rule->transliterate($s); |
|
110 | + } elseif ($rule instanceof \Closure) { |
|
111 | + $s = $rule($s); |
|
112 | + } elseif ($rule) { |
|
113 | + if ('nfd' === $rule = strtolower($rule)) { |
|
114 | + normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD); |
|
115 | + } elseif ('nfkd' === $rule) { |
|
116 | + normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD); |
|
117 | + } elseif ('[:nonspacing mark:] remove' === $rule) { |
|
118 | + $s = preg_replace('/\p{Mn}++/u', '', $s); |
|
119 | + } elseif ('latin-ascii' === $rule) { |
|
120 | + $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s); |
|
121 | + } elseif ('de-ascii' === $rule) { |
|
122 | + $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s); |
|
123 | + $s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s); |
|
124 | + } elseif (\function_exists('transliterator_transliterate')) { |
|
125 | + if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) { |
|
126 | + if ('any-latin/bgn' === $rule) { |
|
127 | + $rule = 'any-latin'; |
|
128 | + $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule); |
|
129 | + } |
|
130 | + |
|
131 | + if (null === $transliterator) { |
|
132 | + throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule)); |
|
133 | + } |
|
134 | + |
|
135 | + self::$transliterators['any-latin/bgn'] = $transliterator; |
|
136 | + } |
|
137 | + |
|
138 | + $s = $transliterator->transliterate($s); |
|
139 | + } |
|
140 | + } elseif (!\function_exists('iconv')) { |
|
141 | + $s = preg_replace('/[^\x00-\x7F]/u', '?', $s); |
|
142 | + } else { |
|
143 | + $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) { |
|
144 | + $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]); |
|
145 | + |
|
146 | + if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) { |
|
147 | + throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class)); |
|
148 | + } |
|
149 | + |
|
150 | + return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?'); |
|
151 | + }, $s); |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + $str->string .= $s; |
|
156 | + |
|
157 | + return $str; |
|
158 | + } |
|
159 | + |
|
160 | + public function camel(): parent |
|
161 | + { |
|
162 | + $str = clone $this; |
|
163 | + $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function ($m) use (&$i) { |
|
164 | + return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); |
|
165 | + }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string))); |
|
166 | + |
|
167 | + return $str; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @return int[] |
|
172 | + */ |
|
173 | + public function codePointsAt(int $offset): array |
|
174 | + { |
|
175 | + $str = $this->slice($offset, 1); |
|
176 | + |
|
177 | + if ('' === $str->string) { |
|
178 | + return []; |
|
179 | + } |
|
180 | + |
|
181 | + $codePoints = []; |
|
182 | + |
|
183 | + foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) { |
|
184 | + $codePoints[] = mb_ord($c, 'UTF-8'); |
|
185 | + } |
|
186 | + |
|
187 | + return $codePoints; |
|
188 | + } |
|
189 | + |
|
190 | + public function folded(bool $compat = true): parent |
|
191 | + { |
|
192 | + $str = clone $this; |
|
193 | + |
|
194 | + if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) { |
|
195 | + $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC); |
|
196 | + $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8'); |
|
197 | + } else { |
|
198 | + $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF); |
|
199 | + } |
|
200 | + |
|
201 | + return $str; |
|
202 | + } |
|
203 | + |
|
204 | + public function join(array $strings, string $lastGlue = null): parent |
|
205 | + { |
|
206 | + $str = clone $this; |
|
207 | + |
|
208 | + $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : ''; |
|
209 | + $str->string = implode($this->string, $strings).$tail; |
|
210 | + |
|
211 | + if (!preg_match('//u', $str->string)) { |
|
212 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
213 | + } |
|
214 | + |
|
215 | + return $str; |
|
216 | + } |
|
217 | + |
|
218 | + public function lower(): parent |
|
219 | + { |
|
220 | + $str = clone $this; |
|
221 | + $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8'); |
|
222 | + |
|
223 | + return $str; |
|
224 | + } |
|
225 | + |
|
226 | + public function match(string $regexp, int $flags = 0, int $offset = 0): array |
|
227 | + { |
|
228 | + $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match'; |
|
229 | + |
|
230 | + if ($this->ignoreCase) { |
|
231 | + $regexp .= 'i'; |
|
232 | + } |
|
233 | + |
|
234 | + set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
235 | + |
|
236 | + try { |
|
237 | + if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) { |
|
238 | + $lastError = preg_last_error(); |
|
239 | + |
|
240 | + foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
|
241 | + if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
|
242 | + throw new RuntimeException('Matching failed with '.$k.'.'); |
|
243 | + } |
|
244 | + } |
|
245 | + |
|
246 | + throw new RuntimeException('Matching failed with unknown error code.'); |
|
247 | + } |
|
248 | + } finally { |
|
249 | + restore_error_handler(); |
|
250 | + } |
|
251 | + |
|
252 | + return $matches; |
|
253 | + } |
|
254 | + |
|
255 | + /** |
|
256 | + * @return static |
|
257 | + */ |
|
258 | + public function normalize(int $form = self::NFC): self |
|
259 | + { |
|
260 | + if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) { |
|
261 | + throw new InvalidArgumentException('Unsupported normalization form.'); |
|
262 | + } |
|
263 | + |
|
264 | + $str = clone $this; |
|
265 | + normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form); |
|
266 | + |
|
267 | + return $str; |
|
268 | + } |
|
269 | + |
|
270 | + public function padBoth(int $length, string $padStr = ' '): parent |
|
271 | + { |
|
272 | + if ('' === $padStr || !preg_match('//u', $padStr)) { |
|
273 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
274 | + } |
|
275 | + |
|
276 | + $pad = clone $this; |
|
277 | + $pad->string = $padStr; |
|
278 | + |
|
279 | + return $this->pad($length, $pad, \STR_PAD_BOTH); |
|
280 | + } |
|
281 | + |
|
282 | + public function padEnd(int $length, string $padStr = ' '): parent |
|
283 | + { |
|
284 | + if ('' === $padStr || !preg_match('//u', $padStr)) { |
|
285 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
286 | + } |
|
287 | + |
|
288 | + $pad = clone $this; |
|
289 | + $pad->string = $padStr; |
|
290 | + |
|
291 | + return $this->pad($length, $pad, \STR_PAD_RIGHT); |
|
292 | + } |
|
293 | + |
|
294 | + public function padStart(int $length, string $padStr = ' '): parent |
|
295 | + { |
|
296 | + if ('' === $padStr || !preg_match('//u', $padStr)) { |
|
297 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
298 | + } |
|
299 | + |
|
300 | + $pad = clone $this; |
|
301 | + $pad->string = $padStr; |
|
302 | + |
|
303 | + return $this->pad($length, $pad, \STR_PAD_LEFT); |
|
304 | + } |
|
305 | + |
|
306 | + public function replaceMatches(string $fromRegexp, $to): parent |
|
307 | + { |
|
308 | + if ($this->ignoreCase) { |
|
309 | + $fromRegexp .= 'i'; |
|
310 | + } |
|
311 | + |
|
312 | + if (\is_array($to) || $to instanceof \Closure) { |
|
313 | + if (!\is_callable($to)) { |
|
314 | + throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class)); |
|
315 | + } |
|
316 | + |
|
317 | + $replace = 'preg_replace_callback'; |
|
318 | + $to = static function (array $m) use ($to): string { |
|
319 | + $to = $to($m); |
|
320 | + |
|
321 | + if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) { |
|
322 | + throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.'); |
|
323 | + } |
|
324 | + |
|
325 | + return $to; |
|
326 | + }; |
|
327 | + } elseif ('' !== $to && !preg_match('//u', $to)) { |
|
328 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
329 | + } else { |
|
330 | + $replace = 'preg_replace'; |
|
331 | + } |
|
332 | + |
|
333 | + set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
334 | + |
|
335 | + try { |
|
336 | + if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) { |
|
337 | + $lastError = preg_last_error(); |
|
338 | + |
|
339 | + foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
|
340 | + if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
|
341 | + throw new RuntimeException('Matching failed with '.$k.'.'); |
|
342 | + } |
|
343 | + } |
|
344 | + |
|
345 | + throw new RuntimeException('Matching failed with unknown error code.'); |
|
346 | + } |
|
347 | + } finally { |
|
348 | + restore_error_handler(); |
|
349 | + } |
|
350 | + |
|
351 | + $str = clone $this; |
|
352 | + $str->string = $string; |
|
353 | + |
|
354 | + return $str; |
|
355 | + } |
|
356 | + |
|
357 | + public function reverse(): parent |
|
358 | + { |
|
359 | + $str = clone $this; |
|
360 | + $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY))); |
|
361 | + |
|
362 | + return $str; |
|
363 | + } |
|
364 | + |
|
365 | + public function snake(): parent |
|
366 | + { |
|
367 | + $str = $this->camel()->title(); |
|
368 | + $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8'); |
|
369 | + |
|
370 | + return $str; |
|
371 | + } |
|
372 | + |
|
373 | + public function title(bool $allWords = false): parent |
|
374 | + { |
|
375 | + $str = clone $this; |
|
376 | + |
|
377 | + $limit = $allWords ? -1 : 1; |
|
378 | + |
|
379 | + $str->string = preg_replace_callback('/\b./u', static function (array $m): string { |
|
380 | + return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); |
|
381 | + }, $str->string, $limit); |
|
382 | + |
|
383 | + return $str; |
|
384 | + } |
|
385 | + |
|
386 | + public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent |
|
387 | + { |
|
388 | + if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) { |
|
389 | + throw new InvalidArgumentException('Invalid UTF-8 chars.'); |
|
390 | + } |
|
391 | + $chars = preg_quote($chars); |
|
392 | + |
|
393 | + $str = clone $this; |
|
394 | + $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string); |
|
395 | + |
|
396 | + return $str; |
|
397 | + } |
|
398 | + |
|
399 | + public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent |
|
400 | + { |
|
401 | + if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) { |
|
402 | + throw new InvalidArgumentException('Invalid UTF-8 chars.'); |
|
403 | + } |
|
404 | + $chars = preg_quote($chars); |
|
405 | + |
|
406 | + $str = clone $this; |
|
407 | + $str->string = preg_replace("{[$chars]++$}uD", '', $str->string); |
|
408 | + |
|
409 | + return $str; |
|
410 | + } |
|
411 | + |
|
412 | + public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent |
|
413 | + { |
|
414 | + if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) { |
|
415 | + throw new InvalidArgumentException('Invalid UTF-8 chars.'); |
|
416 | + } |
|
417 | + $chars = preg_quote($chars); |
|
418 | + |
|
419 | + $str = clone $this; |
|
420 | + $str->string = preg_replace("{^[$chars]++}uD", '', $str->string); |
|
421 | + |
|
422 | + return $str; |
|
423 | + } |
|
424 | + |
|
425 | + public function upper(): parent |
|
426 | + { |
|
427 | + $str = clone $this; |
|
428 | + $str->string = mb_strtoupper($str->string, 'UTF-8'); |
|
429 | + |
|
430 | + if (\PHP_VERSION_ID < 70300) { |
|
431 | + $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string); |
|
432 | + } |
|
433 | + |
|
434 | + return $str; |
|
435 | + } |
|
436 | + |
|
437 | + public function width(bool $ignoreAnsiDecoration = true): int |
|
438 | + { |
|
439 | + $width = 0; |
|
440 | + $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string); |
|
441 | + |
|
442 | + if (false !== strpos($s, "\r")) { |
|
443 | + $s = str_replace(["\r\n", "\r"], "\n", $s); |
|
444 | + } |
|
445 | + |
|
446 | + if (!$ignoreAnsiDecoration) { |
|
447 | + $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s); |
|
448 | + } |
|
449 | 449 | |
450 | - foreach (explode("\n", $s) as $s) { |
|
451 | - if ($ignoreAnsiDecoration) { |
|
452 | - $s = preg_replace('/(?:\x1B(?: |
|
450 | + foreach (explode("\n", $s) as $s) { |
|
451 | + if ($ignoreAnsiDecoration) { |
|
452 | + $s = preg_replace('/(?:\x1B(?: |
|
453 | 453 | \[ [\x30-\x3F]*+ [\x20-\x2F]*+ [0x40-\x7E] |
454 | 454 | | [P\]X^_] .*? \x1B\\\\ |
455 | 455 | | [\x41-\x7E] |
456 | 456 | )|[\p{Cc}\x7F]++)/xu', '', $s); |
457 | - } |
|
458 | - |
|
459 | - // Non printable characters have been dropped, so wcswidth cannot logically return -1. |
|
460 | - $width += $this->wcswidth($s); |
|
461 | - } |
|
462 | - |
|
463 | - return $width; |
|
464 | - } |
|
465 | - |
|
466 | - /** |
|
467 | - * @return static |
|
468 | - */ |
|
469 | - private function pad(int $len, self $pad, int $type): parent |
|
470 | - { |
|
471 | - $sLen = $this->length(); |
|
472 | - |
|
473 | - if ($len <= $sLen) { |
|
474 | - return clone $this; |
|
475 | - } |
|
476 | - |
|
477 | - $padLen = $pad->length(); |
|
478 | - $freeLen = $len - $sLen; |
|
479 | - $len = $freeLen % $padLen; |
|
480 | - |
|
481 | - switch ($type) { |
|
482 | - case \STR_PAD_RIGHT: |
|
483 | - return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
484 | - |
|
485 | - case \STR_PAD_LEFT: |
|
486 | - return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
487 | - |
|
488 | - case \STR_PAD_BOTH: |
|
489 | - $freeLen /= 2; |
|
490 | - |
|
491 | - $rightLen = ceil($freeLen); |
|
492 | - $len = $rightLen % $padLen; |
|
493 | - $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
494 | - |
|
495 | - $leftLen = floor($freeLen); |
|
496 | - $len = $leftLen % $padLen; |
|
497 | - |
|
498 | - return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
499 | - |
|
500 | - default: |
|
501 | - throw new InvalidArgumentException('Invalid padding type.'); |
|
502 | - } |
|
503 | - } |
|
504 | - |
|
505 | - /** |
|
506 | - * Based on https://github.com/jquast/wcwidth, a Python implementation of https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c. |
|
507 | - */ |
|
508 | - private function wcswidth(string $string): int |
|
509 | - { |
|
510 | - $width = 0; |
|
511 | - |
|
512 | - foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) { |
|
513 | - $codePoint = mb_ord($c, 'UTF-8'); |
|
514 | - |
|
515 | - if (0 === $codePoint // NULL |
|
516 | - || 0x034F === $codePoint // COMBINING GRAPHEME JOINER |
|
517 | - || (0x200B <= $codePoint && 0x200F >= $codePoint) // ZERO WIDTH SPACE to RIGHT-TO-LEFT MARK |
|
518 | - || 0x2028 === $codePoint // LINE SEPARATOR |
|
519 | - || 0x2029 === $codePoint // PARAGRAPH SEPARATOR |
|
520 | - || (0x202A <= $codePoint && 0x202E >= $codePoint) // LEFT-TO-RIGHT EMBEDDING to RIGHT-TO-LEFT OVERRIDE |
|
521 | - || (0x2060 <= $codePoint && 0x2063 >= $codePoint) // WORD JOINER to INVISIBLE SEPARATOR |
|
522 | - ) { |
|
523 | - continue; |
|
524 | - } |
|
525 | - |
|
526 | - // Non printable characters |
|
527 | - if (32 > $codePoint // C0 control characters |
|
528 | - || (0x07F <= $codePoint && 0x0A0 > $codePoint) // C1 control characters and DEL |
|
529 | - ) { |
|
530 | - return -1; |
|
531 | - } |
|
532 | - |
|
533 | - static $tableZero; |
|
534 | - if (null === $tableZero) { |
|
535 | - $tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php'; |
|
536 | - } |
|
537 | - |
|
538 | - if ($codePoint >= $tableZero[0][0] && $codePoint <= $tableZero[$ubound = \count($tableZero) - 1][1]) { |
|
539 | - $lbound = 0; |
|
540 | - while ($ubound >= $lbound) { |
|
541 | - $mid = floor(($lbound + $ubound) / 2); |
|
542 | - |
|
543 | - if ($codePoint > $tableZero[$mid][1]) { |
|
544 | - $lbound = $mid + 1; |
|
545 | - } elseif ($codePoint < $tableZero[$mid][0]) { |
|
546 | - $ubound = $mid - 1; |
|
547 | - } else { |
|
548 | - continue 2; |
|
549 | - } |
|
550 | - } |
|
551 | - } |
|
552 | - |
|
553 | - static $tableWide; |
|
554 | - if (null === $tableWide) { |
|
555 | - $tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php'; |
|
556 | - } |
|
557 | - |
|
558 | - if ($codePoint >= $tableWide[0][0] && $codePoint <= $tableWide[$ubound = \count($tableWide) - 1][1]) { |
|
559 | - $lbound = 0; |
|
560 | - while ($ubound >= $lbound) { |
|
561 | - $mid = floor(($lbound + $ubound) / 2); |
|
562 | - |
|
563 | - if ($codePoint > $tableWide[$mid][1]) { |
|
564 | - $lbound = $mid + 1; |
|
565 | - } elseif ($codePoint < $tableWide[$mid][0]) { |
|
566 | - $ubound = $mid - 1; |
|
567 | - } else { |
|
568 | - $width += 2; |
|
569 | - |
|
570 | - continue 2; |
|
571 | - } |
|
572 | - } |
|
573 | - } |
|
574 | - |
|
575 | - ++$width; |
|
576 | - } |
|
577 | - |
|
578 | - return $width; |
|
579 | - } |
|
457 | + } |
|
458 | + |
|
459 | + // Non printable characters have been dropped, so wcswidth cannot logically return -1. |
|
460 | + $width += $this->wcswidth($s); |
|
461 | + } |
|
462 | + |
|
463 | + return $width; |
|
464 | + } |
|
465 | + |
|
466 | + /** |
|
467 | + * @return static |
|
468 | + */ |
|
469 | + private function pad(int $len, self $pad, int $type): parent |
|
470 | + { |
|
471 | + $sLen = $this->length(); |
|
472 | + |
|
473 | + if ($len <= $sLen) { |
|
474 | + return clone $this; |
|
475 | + } |
|
476 | + |
|
477 | + $padLen = $pad->length(); |
|
478 | + $freeLen = $len - $sLen; |
|
479 | + $len = $freeLen % $padLen; |
|
480 | + |
|
481 | + switch ($type) { |
|
482 | + case \STR_PAD_RIGHT: |
|
483 | + return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
484 | + |
|
485 | + case \STR_PAD_LEFT: |
|
486 | + return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
487 | + |
|
488 | + case \STR_PAD_BOTH: |
|
489 | + $freeLen /= 2; |
|
490 | + |
|
491 | + $rightLen = ceil($freeLen); |
|
492 | + $len = $rightLen % $padLen; |
|
493 | + $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
494 | + |
|
495 | + $leftLen = floor($freeLen); |
|
496 | + $len = $leftLen % $padLen; |
|
497 | + |
|
498 | + return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : '')); |
|
499 | + |
|
500 | + default: |
|
501 | + throw new InvalidArgumentException('Invalid padding type.'); |
|
502 | + } |
|
503 | + } |
|
504 | + |
|
505 | + /** |
|
506 | + * Based on https://github.com/jquast/wcwidth, a Python implementation of https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c. |
|
507 | + */ |
|
508 | + private function wcswidth(string $string): int |
|
509 | + { |
|
510 | + $width = 0; |
|
511 | + |
|
512 | + foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) { |
|
513 | + $codePoint = mb_ord($c, 'UTF-8'); |
|
514 | + |
|
515 | + if (0 === $codePoint // NULL |
|
516 | + || 0x034F === $codePoint // COMBINING GRAPHEME JOINER |
|
517 | + || (0x200B <= $codePoint && 0x200F >= $codePoint) // ZERO WIDTH SPACE to RIGHT-TO-LEFT MARK |
|
518 | + || 0x2028 === $codePoint // LINE SEPARATOR |
|
519 | + || 0x2029 === $codePoint // PARAGRAPH SEPARATOR |
|
520 | + || (0x202A <= $codePoint && 0x202E >= $codePoint) // LEFT-TO-RIGHT EMBEDDING to RIGHT-TO-LEFT OVERRIDE |
|
521 | + || (0x2060 <= $codePoint && 0x2063 >= $codePoint) // WORD JOINER to INVISIBLE SEPARATOR |
|
522 | + ) { |
|
523 | + continue; |
|
524 | + } |
|
525 | + |
|
526 | + // Non printable characters |
|
527 | + if (32 > $codePoint // C0 control characters |
|
528 | + || (0x07F <= $codePoint && 0x0A0 > $codePoint) // C1 control characters and DEL |
|
529 | + ) { |
|
530 | + return -1; |
|
531 | + } |
|
532 | + |
|
533 | + static $tableZero; |
|
534 | + if (null === $tableZero) { |
|
535 | + $tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php'; |
|
536 | + } |
|
537 | + |
|
538 | + if ($codePoint >= $tableZero[0][0] && $codePoint <= $tableZero[$ubound = \count($tableZero) - 1][1]) { |
|
539 | + $lbound = 0; |
|
540 | + while ($ubound >= $lbound) { |
|
541 | + $mid = floor(($lbound + $ubound) / 2); |
|
542 | + |
|
543 | + if ($codePoint > $tableZero[$mid][1]) { |
|
544 | + $lbound = $mid + 1; |
|
545 | + } elseif ($codePoint < $tableZero[$mid][0]) { |
|
546 | + $ubound = $mid - 1; |
|
547 | + } else { |
|
548 | + continue 2; |
|
549 | + } |
|
550 | + } |
|
551 | + } |
|
552 | + |
|
553 | + static $tableWide; |
|
554 | + if (null === $tableWide) { |
|
555 | + $tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php'; |
|
556 | + } |
|
557 | + |
|
558 | + if ($codePoint >= $tableWide[0][0] && $codePoint <= $tableWide[$ubound = \count($tableWide) - 1][1]) { |
|
559 | + $lbound = 0; |
|
560 | + while ($ubound >= $lbound) { |
|
561 | + $mid = floor(($lbound + $ubound) / 2); |
|
562 | + |
|
563 | + if ($codePoint > $tableWide[$mid][1]) { |
|
564 | + $lbound = $mid + 1; |
|
565 | + } elseif ($codePoint < $tableWide[$mid][0]) { |
|
566 | + $ubound = $mid - 1; |
|
567 | + } else { |
|
568 | + $width += 2; |
|
569 | + |
|
570 | + continue 2; |
|
571 | + } |
|
572 | + } |
|
573 | + } |
|
574 | + |
|
575 | + ++$width; |
|
576 | + } |
|
577 | + |
|
578 | + return $width; |
|
579 | + } |
|
580 | 580 | } |
@@ -32,346 +32,346 @@ |
||
32 | 32 | */ |
33 | 33 | class UnicodeString extends AbstractUnicodeString |
34 | 34 | { |
35 | - public function __construct(string $string = '') |
|
36 | - { |
|
37 | - $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string); |
|
38 | - |
|
39 | - if (false === $this->string) { |
|
40 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - public function append(string ...$suffix): AbstractString |
|
45 | - { |
|
46 | - $str = clone $this; |
|
47 | - $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix)); |
|
48 | - normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
49 | - |
|
50 | - if (false === $str->string) { |
|
51 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
52 | - } |
|
53 | - |
|
54 | - return $str; |
|
55 | - } |
|
56 | - |
|
57 | - public function chunk(int $length = 1): array |
|
58 | - { |
|
59 | - if (1 > $length) { |
|
60 | - throw new InvalidArgumentException('The chunk length must be greater than zero.'); |
|
61 | - } |
|
62 | - |
|
63 | - if ('' === $this->string) { |
|
64 | - return []; |
|
65 | - } |
|
66 | - |
|
67 | - $rx = '/('; |
|
68 | - while (65535 < $length) { |
|
69 | - $rx .= '\X{65535}'; |
|
70 | - $length -= 65535; |
|
71 | - } |
|
72 | - $rx .= '\X{'.$length.'})/u'; |
|
73 | - |
|
74 | - $str = clone $this; |
|
75 | - $chunks = []; |
|
76 | - |
|
77 | - foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) { |
|
78 | - $str->string = $chunk; |
|
79 | - $chunks[] = clone $str; |
|
80 | - } |
|
81 | - |
|
82 | - return $chunks; |
|
83 | - } |
|
84 | - |
|
85 | - public function endsWith($suffix): bool |
|
86 | - { |
|
87 | - if ($suffix instanceof AbstractString) { |
|
88 | - $suffix = $suffix->string; |
|
89 | - } elseif (\is_array($suffix) || $suffix instanceof \Traversable) { |
|
90 | - return parent::endsWith($suffix); |
|
91 | - } else { |
|
92 | - $suffix = (string) $suffix; |
|
93 | - } |
|
94 | - |
|
95 | - $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
96 | - normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form); |
|
97 | - |
|
98 | - if ('' === $suffix || false === $suffix) { |
|
99 | - return false; |
|
100 | - } |
|
101 | - |
|
102 | - if ($this->ignoreCase) { |
|
103 | - return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8'); |
|
104 | - } |
|
105 | - |
|
106 | - return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)); |
|
107 | - } |
|
108 | - |
|
109 | - public function equalsTo($string): bool |
|
110 | - { |
|
111 | - if ($string instanceof AbstractString) { |
|
112 | - $string = $string->string; |
|
113 | - } elseif (\is_array($string) || $string instanceof \Traversable) { |
|
114 | - return parent::equalsTo($string); |
|
115 | - } else { |
|
116 | - $string = (string) $string; |
|
117 | - } |
|
118 | - |
|
119 | - $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
120 | - normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form); |
|
121 | - |
|
122 | - if ('' !== $string && false !== $string && $this->ignoreCase) { |
|
123 | - return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8'); |
|
124 | - } |
|
125 | - |
|
126 | - return $string === $this->string; |
|
127 | - } |
|
128 | - |
|
129 | - public function indexOf($needle, int $offset = 0): ?int |
|
130 | - { |
|
131 | - if ($needle instanceof AbstractString) { |
|
132 | - $needle = $needle->string; |
|
133 | - } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
134 | - return parent::indexOf($needle, $offset); |
|
135 | - } else { |
|
136 | - $needle = (string) $needle; |
|
137 | - } |
|
138 | - |
|
139 | - $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
140 | - normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form); |
|
141 | - |
|
142 | - if ('' === $needle || false === $needle) { |
|
143 | - return null; |
|
144 | - } |
|
145 | - |
|
146 | - try { |
|
147 | - $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset); |
|
148 | - } catch (\ValueError $e) { |
|
149 | - return null; |
|
150 | - } |
|
151 | - |
|
152 | - return false === $i ? null : $i; |
|
153 | - } |
|
154 | - |
|
155 | - public function indexOfLast($needle, int $offset = 0): ?int |
|
156 | - { |
|
157 | - if ($needle instanceof AbstractString) { |
|
158 | - $needle = $needle->string; |
|
159 | - } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
160 | - return parent::indexOfLast($needle, $offset); |
|
161 | - } else { |
|
162 | - $needle = (string) $needle; |
|
163 | - } |
|
164 | - |
|
165 | - $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
166 | - normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form); |
|
167 | - |
|
168 | - if ('' === $needle || false === $needle) { |
|
169 | - return null; |
|
170 | - } |
|
171 | - |
|
172 | - $string = $this->string; |
|
173 | - |
|
174 | - if (0 > $offset) { |
|
175 | - // workaround https://bugs.php.net/74264 |
|
176 | - if (0 > $offset += grapheme_strlen($needle)) { |
|
177 | - $string = grapheme_substr($string, 0, $offset); |
|
178 | - } |
|
179 | - $offset = 0; |
|
180 | - } |
|
181 | - |
|
182 | - $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset); |
|
183 | - |
|
184 | - return false === $i ? null : $i; |
|
185 | - } |
|
186 | - |
|
187 | - public function join(array $strings, string $lastGlue = null): AbstractString |
|
188 | - { |
|
189 | - $str = parent::join($strings, $lastGlue); |
|
190 | - normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
191 | - |
|
192 | - return $str; |
|
193 | - } |
|
194 | - |
|
195 | - public function length(): int |
|
196 | - { |
|
197 | - return grapheme_strlen($this->string); |
|
198 | - } |
|
199 | - |
|
200 | - /** |
|
201 | - * @return static |
|
202 | - */ |
|
203 | - public function normalize(int $form = self::NFC): parent |
|
204 | - { |
|
205 | - $str = clone $this; |
|
206 | - |
|
207 | - if (\in_array($form, [self::NFC, self::NFKC], true)) { |
|
208 | - normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form); |
|
209 | - } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) { |
|
210 | - throw new InvalidArgumentException('Unsupported normalization form.'); |
|
211 | - } elseif (!normalizer_is_normalized($str->string, $form)) { |
|
212 | - $str->string = normalizer_normalize($str->string, $form); |
|
213 | - $str->ignoreCase = null; |
|
214 | - } |
|
215 | - |
|
216 | - return $str; |
|
217 | - } |
|
218 | - |
|
219 | - public function prepend(string ...$prefix): AbstractString |
|
220 | - { |
|
221 | - $str = clone $this; |
|
222 | - $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string; |
|
223 | - normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
224 | - |
|
225 | - if (false === $str->string) { |
|
226 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
227 | - } |
|
228 | - |
|
229 | - return $str; |
|
230 | - } |
|
231 | - |
|
232 | - public function replace(string $from, string $to): AbstractString |
|
233 | - { |
|
234 | - $str = clone $this; |
|
235 | - normalizer_is_normalized($from) ?: $from = normalizer_normalize($from); |
|
236 | - |
|
237 | - if ('' !== $from && false !== $from) { |
|
238 | - $tail = $str->string; |
|
239 | - $result = ''; |
|
240 | - $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos'; |
|
241 | - |
|
242 | - while ('' !== $tail && false !== $i = $indexOf($tail, $from)) { |
|
243 | - $slice = grapheme_substr($tail, 0, $i); |
|
244 | - $result .= $slice.$to; |
|
245 | - $tail = substr($tail, \strlen($slice) + \strlen($from)); |
|
246 | - } |
|
247 | - |
|
248 | - $str->string = $result.$tail; |
|
249 | - normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
250 | - |
|
251 | - if (false === $str->string) { |
|
252 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
253 | - } |
|
254 | - } |
|
255 | - |
|
256 | - return $str; |
|
257 | - } |
|
258 | - |
|
259 | - public function replaceMatches(string $fromRegexp, $to): AbstractString |
|
260 | - { |
|
261 | - $str = parent::replaceMatches($fromRegexp, $to); |
|
262 | - normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
263 | - |
|
264 | - return $str; |
|
265 | - } |
|
266 | - |
|
267 | - public function slice(int $start = 0, int $length = null): AbstractString |
|
268 | - { |
|
269 | - $str = clone $this; |
|
270 | - |
|
271 | - if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) { |
|
272 | - $start = 0; |
|
273 | - } |
|
274 | - $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647); |
|
275 | - |
|
276 | - return $str; |
|
277 | - } |
|
278 | - |
|
279 | - public function splice(string $replacement, int $start = 0, int $length = null): AbstractString |
|
280 | - { |
|
281 | - $str = clone $this; |
|
282 | - |
|
283 | - if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) { |
|
284 | - $start = 0; |
|
285 | - } |
|
286 | - $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0; |
|
287 | - $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length; |
|
288 | - $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647); |
|
289 | - normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
290 | - |
|
291 | - if (false === $str->string) { |
|
292 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
293 | - } |
|
294 | - |
|
295 | - return $str; |
|
296 | - } |
|
297 | - |
|
298 | - public function split(string $delimiter, int $limit = null, int $flags = null): array |
|
299 | - { |
|
300 | - if (1 > $limit = $limit ?? 2147483647) { |
|
301 | - throw new InvalidArgumentException('Split limit must be a positive integer.'); |
|
302 | - } |
|
303 | - |
|
304 | - if ('' === $delimiter) { |
|
305 | - throw new InvalidArgumentException('Split delimiter is empty.'); |
|
306 | - } |
|
307 | - |
|
308 | - if (null !== $flags) { |
|
309 | - return parent::split($delimiter.'u', $limit, $flags); |
|
310 | - } |
|
311 | - |
|
312 | - normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter); |
|
313 | - |
|
314 | - if (false === $delimiter) { |
|
315 | - throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.'); |
|
316 | - } |
|
317 | - |
|
318 | - $str = clone $this; |
|
319 | - $tail = $this->string; |
|
320 | - $chunks = []; |
|
321 | - $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos'; |
|
322 | - |
|
323 | - while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) { |
|
324 | - $str->string = grapheme_substr($tail, 0, $i); |
|
325 | - $chunks[] = clone $str; |
|
326 | - $tail = substr($tail, \strlen($str->string) + \strlen($delimiter)); |
|
327 | - --$limit; |
|
328 | - } |
|
329 | - |
|
330 | - $str->string = $tail; |
|
331 | - $chunks[] = clone $str; |
|
332 | - |
|
333 | - return $chunks; |
|
334 | - } |
|
335 | - |
|
336 | - public function startsWith($prefix): bool |
|
337 | - { |
|
338 | - if ($prefix instanceof AbstractString) { |
|
339 | - $prefix = $prefix->string; |
|
340 | - } elseif (\is_array($prefix) || $prefix instanceof \Traversable) { |
|
341 | - return parent::startsWith($prefix); |
|
342 | - } else { |
|
343 | - $prefix = (string) $prefix; |
|
344 | - } |
|
345 | - |
|
346 | - $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
347 | - normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form); |
|
348 | - |
|
349 | - if ('' === $prefix || false === $prefix) { |
|
350 | - return false; |
|
351 | - } |
|
352 | - |
|
353 | - if ($this->ignoreCase) { |
|
354 | - return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8'); |
|
355 | - } |
|
356 | - |
|
357 | - return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES); |
|
358 | - } |
|
359 | - |
|
360 | - public function __wakeup() |
|
361 | - { |
|
362 | - if (!\is_string($this->string)) { |
|
363 | - throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); |
|
364 | - } |
|
365 | - |
|
366 | - normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string); |
|
367 | - } |
|
368 | - |
|
369 | - public function __clone() |
|
370 | - { |
|
371 | - if (null === $this->ignoreCase) { |
|
372 | - normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string); |
|
373 | - } |
|
374 | - |
|
375 | - $this->ignoreCase = false; |
|
376 | - } |
|
35 | + public function __construct(string $string = '') |
|
36 | + { |
|
37 | + $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string); |
|
38 | + |
|
39 | + if (false === $this->string) { |
|
40 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + public function append(string ...$suffix): AbstractString |
|
45 | + { |
|
46 | + $str = clone $this; |
|
47 | + $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix)); |
|
48 | + normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
49 | + |
|
50 | + if (false === $str->string) { |
|
51 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
52 | + } |
|
53 | + |
|
54 | + return $str; |
|
55 | + } |
|
56 | + |
|
57 | + public function chunk(int $length = 1): array |
|
58 | + { |
|
59 | + if (1 > $length) { |
|
60 | + throw new InvalidArgumentException('The chunk length must be greater than zero.'); |
|
61 | + } |
|
62 | + |
|
63 | + if ('' === $this->string) { |
|
64 | + return []; |
|
65 | + } |
|
66 | + |
|
67 | + $rx = '/('; |
|
68 | + while (65535 < $length) { |
|
69 | + $rx .= '\X{65535}'; |
|
70 | + $length -= 65535; |
|
71 | + } |
|
72 | + $rx .= '\X{'.$length.'})/u'; |
|
73 | + |
|
74 | + $str = clone $this; |
|
75 | + $chunks = []; |
|
76 | + |
|
77 | + foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) { |
|
78 | + $str->string = $chunk; |
|
79 | + $chunks[] = clone $str; |
|
80 | + } |
|
81 | + |
|
82 | + return $chunks; |
|
83 | + } |
|
84 | + |
|
85 | + public function endsWith($suffix): bool |
|
86 | + { |
|
87 | + if ($suffix instanceof AbstractString) { |
|
88 | + $suffix = $suffix->string; |
|
89 | + } elseif (\is_array($suffix) || $suffix instanceof \Traversable) { |
|
90 | + return parent::endsWith($suffix); |
|
91 | + } else { |
|
92 | + $suffix = (string) $suffix; |
|
93 | + } |
|
94 | + |
|
95 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
96 | + normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form); |
|
97 | + |
|
98 | + if ('' === $suffix || false === $suffix) { |
|
99 | + return false; |
|
100 | + } |
|
101 | + |
|
102 | + if ($this->ignoreCase) { |
|
103 | + return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8'); |
|
104 | + } |
|
105 | + |
|
106 | + return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)); |
|
107 | + } |
|
108 | + |
|
109 | + public function equalsTo($string): bool |
|
110 | + { |
|
111 | + if ($string instanceof AbstractString) { |
|
112 | + $string = $string->string; |
|
113 | + } elseif (\is_array($string) || $string instanceof \Traversable) { |
|
114 | + return parent::equalsTo($string); |
|
115 | + } else { |
|
116 | + $string = (string) $string; |
|
117 | + } |
|
118 | + |
|
119 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
120 | + normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form); |
|
121 | + |
|
122 | + if ('' !== $string && false !== $string && $this->ignoreCase) { |
|
123 | + return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8'); |
|
124 | + } |
|
125 | + |
|
126 | + return $string === $this->string; |
|
127 | + } |
|
128 | + |
|
129 | + public function indexOf($needle, int $offset = 0): ?int |
|
130 | + { |
|
131 | + if ($needle instanceof AbstractString) { |
|
132 | + $needle = $needle->string; |
|
133 | + } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
134 | + return parent::indexOf($needle, $offset); |
|
135 | + } else { |
|
136 | + $needle = (string) $needle; |
|
137 | + } |
|
138 | + |
|
139 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
140 | + normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form); |
|
141 | + |
|
142 | + if ('' === $needle || false === $needle) { |
|
143 | + return null; |
|
144 | + } |
|
145 | + |
|
146 | + try { |
|
147 | + $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset); |
|
148 | + } catch (\ValueError $e) { |
|
149 | + return null; |
|
150 | + } |
|
151 | + |
|
152 | + return false === $i ? null : $i; |
|
153 | + } |
|
154 | + |
|
155 | + public function indexOfLast($needle, int $offset = 0): ?int |
|
156 | + { |
|
157 | + if ($needle instanceof AbstractString) { |
|
158 | + $needle = $needle->string; |
|
159 | + } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
160 | + return parent::indexOfLast($needle, $offset); |
|
161 | + } else { |
|
162 | + $needle = (string) $needle; |
|
163 | + } |
|
164 | + |
|
165 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
166 | + normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form); |
|
167 | + |
|
168 | + if ('' === $needle || false === $needle) { |
|
169 | + return null; |
|
170 | + } |
|
171 | + |
|
172 | + $string = $this->string; |
|
173 | + |
|
174 | + if (0 > $offset) { |
|
175 | + // workaround https://bugs.php.net/74264 |
|
176 | + if (0 > $offset += grapheme_strlen($needle)) { |
|
177 | + $string = grapheme_substr($string, 0, $offset); |
|
178 | + } |
|
179 | + $offset = 0; |
|
180 | + } |
|
181 | + |
|
182 | + $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset); |
|
183 | + |
|
184 | + return false === $i ? null : $i; |
|
185 | + } |
|
186 | + |
|
187 | + public function join(array $strings, string $lastGlue = null): AbstractString |
|
188 | + { |
|
189 | + $str = parent::join($strings, $lastGlue); |
|
190 | + normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
191 | + |
|
192 | + return $str; |
|
193 | + } |
|
194 | + |
|
195 | + public function length(): int |
|
196 | + { |
|
197 | + return grapheme_strlen($this->string); |
|
198 | + } |
|
199 | + |
|
200 | + /** |
|
201 | + * @return static |
|
202 | + */ |
|
203 | + public function normalize(int $form = self::NFC): parent |
|
204 | + { |
|
205 | + $str = clone $this; |
|
206 | + |
|
207 | + if (\in_array($form, [self::NFC, self::NFKC], true)) { |
|
208 | + normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form); |
|
209 | + } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) { |
|
210 | + throw new InvalidArgumentException('Unsupported normalization form.'); |
|
211 | + } elseif (!normalizer_is_normalized($str->string, $form)) { |
|
212 | + $str->string = normalizer_normalize($str->string, $form); |
|
213 | + $str->ignoreCase = null; |
|
214 | + } |
|
215 | + |
|
216 | + return $str; |
|
217 | + } |
|
218 | + |
|
219 | + public function prepend(string ...$prefix): AbstractString |
|
220 | + { |
|
221 | + $str = clone $this; |
|
222 | + $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string; |
|
223 | + normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
224 | + |
|
225 | + if (false === $str->string) { |
|
226 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
227 | + } |
|
228 | + |
|
229 | + return $str; |
|
230 | + } |
|
231 | + |
|
232 | + public function replace(string $from, string $to): AbstractString |
|
233 | + { |
|
234 | + $str = clone $this; |
|
235 | + normalizer_is_normalized($from) ?: $from = normalizer_normalize($from); |
|
236 | + |
|
237 | + if ('' !== $from && false !== $from) { |
|
238 | + $tail = $str->string; |
|
239 | + $result = ''; |
|
240 | + $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos'; |
|
241 | + |
|
242 | + while ('' !== $tail && false !== $i = $indexOf($tail, $from)) { |
|
243 | + $slice = grapheme_substr($tail, 0, $i); |
|
244 | + $result .= $slice.$to; |
|
245 | + $tail = substr($tail, \strlen($slice) + \strlen($from)); |
|
246 | + } |
|
247 | + |
|
248 | + $str->string = $result.$tail; |
|
249 | + normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
250 | + |
|
251 | + if (false === $str->string) { |
|
252 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
253 | + } |
|
254 | + } |
|
255 | + |
|
256 | + return $str; |
|
257 | + } |
|
258 | + |
|
259 | + public function replaceMatches(string $fromRegexp, $to): AbstractString |
|
260 | + { |
|
261 | + $str = parent::replaceMatches($fromRegexp, $to); |
|
262 | + normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
263 | + |
|
264 | + return $str; |
|
265 | + } |
|
266 | + |
|
267 | + public function slice(int $start = 0, int $length = null): AbstractString |
|
268 | + { |
|
269 | + $str = clone $this; |
|
270 | + |
|
271 | + if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) { |
|
272 | + $start = 0; |
|
273 | + } |
|
274 | + $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647); |
|
275 | + |
|
276 | + return $str; |
|
277 | + } |
|
278 | + |
|
279 | + public function splice(string $replacement, int $start = 0, int $length = null): AbstractString |
|
280 | + { |
|
281 | + $str = clone $this; |
|
282 | + |
|
283 | + if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) { |
|
284 | + $start = 0; |
|
285 | + } |
|
286 | + $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0; |
|
287 | + $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length; |
|
288 | + $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647); |
|
289 | + normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
|
290 | + |
|
291 | + if (false === $str->string) { |
|
292 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
293 | + } |
|
294 | + |
|
295 | + return $str; |
|
296 | + } |
|
297 | + |
|
298 | + public function split(string $delimiter, int $limit = null, int $flags = null): array |
|
299 | + { |
|
300 | + if (1 > $limit = $limit ?? 2147483647) { |
|
301 | + throw new InvalidArgumentException('Split limit must be a positive integer.'); |
|
302 | + } |
|
303 | + |
|
304 | + if ('' === $delimiter) { |
|
305 | + throw new InvalidArgumentException('Split delimiter is empty.'); |
|
306 | + } |
|
307 | + |
|
308 | + if (null !== $flags) { |
|
309 | + return parent::split($delimiter.'u', $limit, $flags); |
|
310 | + } |
|
311 | + |
|
312 | + normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter); |
|
313 | + |
|
314 | + if (false === $delimiter) { |
|
315 | + throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.'); |
|
316 | + } |
|
317 | + |
|
318 | + $str = clone $this; |
|
319 | + $tail = $this->string; |
|
320 | + $chunks = []; |
|
321 | + $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos'; |
|
322 | + |
|
323 | + while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) { |
|
324 | + $str->string = grapheme_substr($tail, 0, $i); |
|
325 | + $chunks[] = clone $str; |
|
326 | + $tail = substr($tail, \strlen($str->string) + \strlen($delimiter)); |
|
327 | + --$limit; |
|
328 | + } |
|
329 | + |
|
330 | + $str->string = $tail; |
|
331 | + $chunks[] = clone $str; |
|
332 | + |
|
333 | + return $chunks; |
|
334 | + } |
|
335 | + |
|
336 | + public function startsWith($prefix): bool |
|
337 | + { |
|
338 | + if ($prefix instanceof AbstractString) { |
|
339 | + $prefix = $prefix->string; |
|
340 | + } elseif (\is_array($prefix) || $prefix instanceof \Traversable) { |
|
341 | + return parent::startsWith($prefix); |
|
342 | + } else { |
|
343 | + $prefix = (string) $prefix; |
|
344 | + } |
|
345 | + |
|
346 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; |
|
347 | + normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form); |
|
348 | + |
|
349 | + if ('' === $prefix || false === $prefix) { |
|
350 | + return false; |
|
351 | + } |
|
352 | + |
|
353 | + if ($this->ignoreCase) { |
|
354 | + return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8'); |
|
355 | + } |
|
356 | + |
|
357 | + return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES); |
|
358 | + } |
|
359 | + |
|
360 | + public function __wakeup() |
|
361 | + { |
|
362 | + if (!\is_string($this->string)) { |
|
363 | + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); |
|
364 | + } |
|
365 | + |
|
366 | + normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string); |
|
367 | + } |
|
368 | + |
|
369 | + public function __clone() |
|
370 | + { |
|
371 | + if (null === $this->ignoreCase) { |
|
372 | + normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string); |
|
373 | + } |
|
374 | + |
|
375 | + $this->ignoreCase = false; |
|
376 | + } |
|
377 | 377 | } |
@@ -18,147 +18,147 @@ |
||
18 | 18 | */ |
19 | 19 | class LazyString implements \Stringable, \JsonSerializable |
20 | 20 | { |
21 | - private $value; |
|
22 | - |
|
23 | - /** |
|
24 | - * @param callable|array $callback A callable or a [Closure, method] lazy-callable |
|
25 | - * |
|
26 | - * @return static |
|
27 | - */ |
|
28 | - public static function fromCallable($callback, ...$arguments): self |
|
29 | - { |
|
30 | - if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) { |
|
31 | - throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type($callback))); |
|
32 | - } |
|
33 | - |
|
34 | - $lazyString = new static(); |
|
35 | - $lazyString->value = static function () use (&$callback, &$arguments, &$value): string { |
|
36 | - if (null !== $arguments) { |
|
37 | - if (!\is_callable($callback)) { |
|
38 | - $callback[0] = $callback[0](); |
|
39 | - $callback[1] = $callback[1] ?? '__invoke'; |
|
40 | - } |
|
41 | - $value = $callback(...$arguments); |
|
42 | - $callback = self::getPrettyName($callback); |
|
43 | - $arguments = null; |
|
44 | - } |
|
45 | - |
|
46 | - return $value ?? ''; |
|
47 | - }; |
|
48 | - |
|
49 | - return $lazyString; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @param string|int|float|bool|\Stringable $value |
|
54 | - * |
|
55 | - * @return static |
|
56 | - */ |
|
57 | - public static function fromStringable($value): self |
|
58 | - { |
|
59 | - if (!self::isStringable($value)) { |
|
60 | - throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value))); |
|
61 | - } |
|
62 | - |
|
63 | - if (\is_object($value)) { |
|
64 | - return static::fromCallable([$value, '__toString']); |
|
65 | - } |
|
66 | - |
|
67 | - $lazyString = new static(); |
|
68 | - $lazyString->value = (string) $value; |
|
69 | - |
|
70 | - return $lazyString; |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * Tells whether the provided value can be cast to string. |
|
75 | - */ |
|
76 | - final public static function isStringable($value): bool |
|
77 | - { |
|
78 | - return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : is_scalar($value)); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Casts scalars and stringable objects to strings. |
|
83 | - * |
|
84 | - * @param object|string|int|float|bool $value |
|
85 | - * |
|
86 | - * @throws \TypeError When the provided value is not stringable |
|
87 | - */ |
|
88 | - final public static function resolve($value): string |
|
89 | - { |
|
90 | - return $value; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @return string |
|
95 | - */ |
|
96 | - public function __toString() |
|
97 | - { |
|
98 | - if (\is_string($this->value)) { |
|
99 | - return $this->value; |
|
100 | - } |
|
101 | - |
|
102 | - try { |
|
103 | - return $this->value = ($this->value)(); |
|
104 | - } catch (\Throwable $e) { |
|
105 | - if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) { |
|
106 | - $type = explode(', ', $e->getMessage()); |
|
107 | - $type = substr(array_pop($type), 0, -\strlen(' returned')); |
|
108 | - $r = new \ReflectionFunction($this->value); |
|
109 | - $callback = $r->getStaticVariables()['callback']; |
|
110 | - |
|
111 | - $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type)); |
|
112 | - } |
|
113 | - |
|
114 | - if (\PHP_VERSION_ID < 70400) { |
|
115 | - // leverage the ErrorHandler component with graceful fallback when it's not available |
|
116 | - return trigger_error($e, \E_USER_ERROR); |
|
117 | - } |
|
118 | - |
|
119 | - throw $e; |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - public function __sleep(): array |
|
124 | - { |
|
125 | - $this->__toString(); |
|
126 | - |
|
127 | - return ['value']; |
|
128 | - } |
|
129 | - |
|
130 | - public function jsonSerialize(): string |
|
131 | - { |
|
132 | - return $this->__toString(); |
|
133 | - } |
|
134 | - |
|
135 | - private function __construct() |
|
136 | - { |
|
137 | - } |
|
138 | - |
|
139 | - private static function getPrettyName(callable $callback): string |
|
140 | - { |
|
141 | - if (\is_string($callback)) { |
|
142 | - return $callback; |
|
143 | - } |
|
144 | - |
|
145 | - if (\is_array($callback)) { |
|
146 | - $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0]; |
|
147 | - $method = $callback[1]; |
|
148 | - } elseif ($callback instanceof \Closure) { |
|
149 | - $r = new \ReflectionFunction($callback); |
|
150 | - |
|
151 | - if (false !== strpos($r->name, '{closure}') || !$class = $r->getClosureScopeClass()) { |
|
152 | - return $r->name; |
|
153 | - } |
|
154 | - |
|
155 | - $class = $class->name; |
|
156 | - $method = $r->name; |
|
157 | - } else { |
|
158 | - $class = get_debug_type($callback); |
|
159 | - $method = '__invoke'; |
|
160 | - } |
|
161 | - |
|
162 | - return $class.'::'.$method; |
|
163 | - } |
|
21 | + private $value; |
|
22 | + |
|
23 | + /** |
|
24 | + * @param callable|array $callback A callable or a [Closure, method] lazy-callable |
|
25 | + * |
|
26 | + * @return static |
|
27 | + */ |
|
28 | + public static function fromCallable($callback, ...$arguments): self |
|
29 | + { |
|
30 | + if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) { |
|
31 | + throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type($callback))); |
|
32 | + } |
|
33 | + |
|
34 | + $lazyString = new static(); |
|
35 | + $lazyString->value = static function () use (&$callback, &$arguments, &$value): string { |
|
36 | + if (null !== $arguments) { |
|
37 | + if (!\is_callable($callback)) { |
|
38 | + $callback[0] = $callback[0](); |
|
39 | + $callback[1] = $callback[1] ?? '__invoke'; |
|
40 | + } |
|
41 | + $value = $callback(...$arguments); |
|
42 | + $callback = self::getPrettyName($callback); |
|
43 | + $arguments = null; |
|
44 | + } |
|
45 | + |
|
46 | + return $value ?? ''; |
|
47 | + }; |
|
48 | + |
|
49 | + return $lazyString; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @param string|int|float|bool|\Stringable $value |
|
54 | + * |
|
55 | + * @return static |
|
56 | + */ |
|
57 | + public static function fromStringable($value): self |
|
58 | + { |
|
59 | + if (!self::isStringable($value)) { |
|
60 | + throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value))); |
|
61 | + } |
|
62 | + |
|
63 | + if (\is_object($value)) { |
|
64 | + return static::fromCallable([$value, '__toString']); |
|
65 | + } |
|
66 | + |
|
67 | + $lazyString = new static(); |
|
68 | + $lazyString->value = (string) $value; |
|
69 | + |
|
70 | + return $lazyString; |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * Tells whether the provided value can be cast to string. |
|
75 | + */ |
|
76 | + final public static function isStringable($value): bool |
|
77 | + { |
|
78 | + return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : is_scalar($value)); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Casts scalars and stringable objects to strings. |
|
83 | + * |
|
84 | + * @param object|string|int|float|bool $value |
|
85 | + * |
|
86 | + * @throws \TypeError When the provided value is not stringable |
|
87 | + */ |
|
88 | + final public static function resolve($value): string |
|
89 | + { |
|
90 | + return $value; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @return string |
|
95 | + */ |
|
96 | + public function __toString() |
|
97 | + { |
|
98 | + if (\is_string($this->value)) { |
|
99 | + return $this->value; |
|
100 | + } |
|
101 | + |
|
102 | + try { |
|
103 | + return $this->value = ($this->value)(); |
|
104 | + } catch (\Throwable $e) { |
|
105 | + if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) { |
|
106 | + $type = explode(', ', $e->getMessage()); |
|
107 | + $type = substr(array_pop($type), 0, -\strlen(' returned')); |
|
108 | + $r = new \ReflectionFunction($this->value); |
|
109 | + $callback = $r->getStaticVariables()['callback']; |
|
110 | + |
|
111 | + $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type)); |
|
112 | + } |
|
113 | + |
|
114 | + if (\PHP_VERSION_ID < 70400) { |
|
115 | + // leverage the ErrorHandler component with graceful fallback when it's not available |
|
116 | + return trigger_error($e, \E_USER_ERROR); |
|
117 | + } |
|
118 | + |
|
119 | + throw $e; |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + public function __sleep(): array |
|
124 | + { |
|
125 | + $this->__toString(); |
|
126 | + |
|
127 | + return ['value']; |
|
128 | + } |
|
129 | + |
|
130 | + public function jsonSerialize(): string |
|
131 | + { |
|
132 | + return $this->__toString(); |
|
133 | + } |
|
134 | + |
|
135 | + private function __construct() |
|
136 | + { |
|
137 | + } |
|
138 | + |
|
139 | + private static function getPrettyName(callable $callback): string |
|
140 | + { |
|
141 | + if (\is_string($callback)) { |
|
142 | + return $callback; |
|
143 | + } |
|
144 | + |
|
145 | + if (\is_array($callback)) { |
|
146 | + $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0]; |
|
147 | + $method = $callback[1]; |
|
148 | + } elseif ($callback instanceof \Closure) { |
|
149 | + $r = new \ReflectionFunction($callback); |
|
150 | + |
|
151 | + if (false !== strpos($r->name, '{closure}') || !$class = $r->getClosureScopeClass()) { |
|
152 | + return $r->name; |
|
153 | + } |
|
154 | + |
|
155 | + $class = $class->name; |
|
156 | + $method = $r->name; |
|
157 | + } else { |
|
158 | + $class = get_debug_type($callback); |
|
159 | + $method = '__invoke'; |
|
160 | + } |
|
161 | + |
|
162 | + return $class.'::'.$method; |
|
163 | + } |
|
164 | 164 | } |
@@ -29,699 +29,699 @@ |
||
29 | 29 | */ |
30 | 30 | abstract class AbstractString implements \Stringable, \JsonSerializable |
31 | 31 | { |
32 | - public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER; |
|
33 | - public const PREG_SET_ORDER = \PREG_SET_ORDER; |
|
34 | - public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE; |
|
35 | - public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL; |
|
36 | - |
|
37 | - public const PREG_SPLIT = 0; |
|
38 | - public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY; |
|
39 | - public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE; |
|
40 | - public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE; |
|
41 | - |
|
42 | - protected $string = ''; |
|
43 | - protected $ignoreCase = false; |
|
44 | - |
|
45 | - abstract public function __construct(string $string = ''); |
|
46 | - |
|
47 | - /** |
|
48 | - * Unwraps instances of AbstractString back to strings. |
|
49 | - * |
|
50 | - * @return string[]|array |
|
51 | - */ |
|
52 | - public static function unwrap(array $values): array |
|
53 | - { |
|
54 | - foreach ($values as $k => $v) { |
|
55 | - if ($v instanceof self) { |
|
56 | - $values[$k] = $v->__toString(); |
|
57 | - } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) { |
|
58 | - $values[$k] = $v; |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - return $values; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * Wraps (and normalizes) strings in instances of AbstractString. |
|
67 | - * |
|
68 | - * @return static[]|array |
|
69 | - */ |
|
70 | - public static function wrap(array $values): array |
|
71 | - { |
|
72 | - $i = 0; |
|
73 | - $keys = null; |
|
74 | - |
|
75 | - foreach ($values as $k => $v) { |
|
76 | - if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) { |
|
77 | - $keys = $keys ?? array_keys($values); |
|
78 | - $keys[$i] = $j; |
|
79 | - } |
|
80 | - |
|
81 | - if (\is_string($v)) { |
|
82 | - $values[$k] = new static($v); |
|
83 | - } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) { |
|
84 | - $values[$k] = $v; |
|
85 | - } |
|
86 | - |
|
87 | - ++$i; |
|
88 | - } |
|
89 | - |
|
90 | - return null !== $keys ? array_combine($keys, $values) : $values; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * @param string|string[] $needle |
|
95 | - * |
|
96 | - * @return static |
|
97 | - */ |
|
98 | - public function after($needle, bool $includeNeedle = false, int $offset = 0): self |
|
99 | - { |
|
100 | - $str = clone $this; |
|
101 | - $i = \PHP_INT_MAX; |
|
102 | - |
|
103 | - foreach ((array) $needle as $n) { |
|
104 | - $n = (string) $n; |
|
105 | - $j = $this->indexOf($n, $offset); |
|
106 | - |
|
107 | - if (null !== $j && $j < $i) { |
|
108 | - $i = $j; |
|
109 | - $str->string = $n; |
|
110 | - } |
|
111 | - } |
|
112 | - |
|
113 | - if (\PHP_INT_MAX === $i) { |
|
114 | - return $str; |
|
115 | - } |
|
116 | - |
|
117 | - if (!$includeNeedle) { |
|
118 | - $i += $str->length(); |
|
119 | - } |
|
120 | - |
|
121 | - return $this->slice($i); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @param string|string[] $needle |
|
126 | - * |
|
127 | - * @return static |
|
128 | - */ |
|
129 | - public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self |
|
130 | - { |
|
131 | - $str = clone $this; |
|
132 | - $i = null; |
|
133 | - |
|
134 | - foreach ((array) $needle as $n) { |
|
135 | - $n = (string) $n; |
|
136 | - $j = $this->indexOfLast($n, $offset); |
|
137 | - |
|
138 | - if (null !== $j && $j >= $i) { |
|
139 | - $i = $offset = $j; |
|
140 | - $str->string = $n; |
|
141 | - } |
|
142 | - } |
|
143 | - |
|
144 | - if (null === $i) { |
|
145 | - return $str; |
|
146 | - } |
|
147 | - |
|
148 | - if (!$includeNeedle) { |
|
149 | - $i += $str->length(); |
|
150 | - } |
|
151 | - |
|
152 | - return $this->slice($i); |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * @return static |
|
157 | - */ |
|
158 | - abstract public function append(string ...$suffix): self; |
|
159 | - |
|
160 | - /** |
|
161 | - * @param string|string[] $needle |
|
162 | - * |
|
163 | - * @return static |
|
164 | - */ |
|
165 | - public function before($needle, bool $includeNeedle = false, int $offset = 0): self |
|
166 | - { |
|
167 | - $str = clone $this; |
|
168 | - $i = \PHP_INT_MAX; |
|
169 | - |
|
170 | - foreach ((array) $needle as $n) { |
|
171 | - $n = (string) $n; |
|
172 | - $j = $this->indexOf($n, $offset); |
|
173 | - |
|
174 | - if (null !== $j && $j < $i) { |
|
175 | - $i = $j; |
|
176 | - $str->string = $n; |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - if (\PHP_INT_MAX === $i) { |
|
181 | - return $str; |
|
182 | - } |
|
183 | - |
|
184 | - if ($includeNeedle) { |
|
185 | - $i += $str->length(); |
|
186 | - } |
|
187 | - |
|
188 | - return $this->slice(0, $i); |
|
189 | - } |
|
190 | - |
|
191 | - /** |
|
192 | - * @param string|string[] $needle |
|
193 | - * |
|
194 | - * @return static |
|
195 | - */ |
|
196 | - public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self |
|
197 | - { |
|
198 | - $str = clone $this; |
|
199 | - $i = null; |
|
200 | - |
|
201 | - foreach ((array) $needle as $n) { |
|
202 | - $n = (string) $n; |
|
203 | - $j = $this->indexOfLast($n, $offset); |
|
204 | - |
|
205 | - if (null !== $j && $j >= $i) { |
|
206 | - $i = $offset = $j; |
|
207 | - $str->string = $n; |
|
208 | - } |
|
209 | - } |
|
210 | - |
|
211 | - if (null === $i) { |
|
212 | - return $str; |
|
213 | - } |
|
214 | - |
|
215 | - if ($includeNeedle) { |
|
216 | - $i += $str->length(); |
|
217 | - } |
|
218 | - |
|
219 | - return $this->slice(0, $i); |
|
220 | - } |
|
221 | - |
|
222 | - /** |
|
223 | - * @return int[] |
|
224 | - */ |
|
225 | - public function bytesAt(int $offset): array |
|
226 | - { |
|
227 | - $str = $this->slice($offset, 1); |
|
228 | - |
|
229 | - return '' === $str->string ? [] : array_values(unpack('C*', $str->string)); |
|
230 | - } |
|
231 | - |
|
232 | - /** |
|
233 | - * @return static |
|
234 | - */ |
|
235 | - abstract public function camel(): self; |
|
236 | - |
|
237 | - /** |
|
238 | - * @return static[] |
|
239 | - */ |
|
240 | - abstract public function chunk(int $length = 1): array; |
|
241 | - |
|
242 | - /** |
|
243 | - * @return static |
|
244 | - */ |
|
245 | - public function collapseWhitespace(): self |
|
246 | - { |
|
247 | - $str = clone $this; |
|
248 | - $str->string = trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $str->string)); |
|
249 | - |
|
250 | - return $str; |
|
251 | - } |
|
252 | - |
|
253 | - /** |
|
254 | - * @param string|string[] $needle |
|
255 | - */ |
|
256 | - public function containsAny($needle): bool |
|
257 | - { |
|
258 | - return null !== $this->indexOf($needle); |
|
259 | - } |
|
260 | - |
|
261 | - /** |
|
262 | - * @param string|string[] $suffix |
|
263 | - */ |
|
264 | - public function endsWith($suffix): bool |
|
265 | - { |
|
266 | - if (!\is_array($suffix) && !$suffix instanceof \Traversable) { |
|
267 | - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
268 | - } |
|
269 | - |
|
270 | - foreach ($suffix as $s) { |
|
271 | - if ($this->endsWith((string) $s)) { |
|
272 | - return true; |
|
273 | - } |
|
274 | - } |
|
275 | - |
|
276 | - return false; |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * @return static |
|
281 | - */ |
|
282 | - public function ensureEnd(string $suffix): self |
|
283 | - { |
|
284 | - if (!$this->endsWith($suffix)) { |
|
285 | - return $this->append($suffix); |
|
286 | - } |
|
287 | - |
|
288 | - $suffix = preg_quote($suffix); |
|
289 | - $regex = '{('.$suffix.')(?:'.$suffix.')++$}D'; |
|
290 | - |
|
291 | - return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1'); |
|
292 | - } |
|
293 | - |
|
294 | - /** |
|
295 | - * @return static |
|
296 | - */ |
|
297 | - public function ensureStart(string $prefix): self |
|
298 | - { |
|
299 | - $prefix = new static($prefix); |
|
300 | - |
|
301 | - if (!$this->startsWith($prefix)) { |
|
302 | - return $this->prepend($prefix); |
|
303 | - } |
|
304 | - |
|
305 | - $str = clone $this; |
|
306 | - $i = $prefixLen = $prefix->length(); |
|
307 | - |
|
308 | - while ($this->indexOf($prefix, $i) === $i) { |
|
309 | - $str = $str->slice($prefixLen); |
|
310 | - $i += $prefixLen; |
|
311 | - } |
|
312 | - |
|
313 | - return $str; |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * @param string|string[] $string |
|
318 | - */ |
|
319 | - public function equalsTo($string): bool |
|
320 | - { |
|
321 | - if (!\is_array($string) && !$string instanceof \Traversable) { |
|
322 | - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
323 | - } |
|
324 | - |
|
325 | - foreach ($string as $s) { |
|
326 | - if ($this->equalsTo((string) $s)) { |
|
327 | - return true; |
|
328 | - } |
|
329 | - } |
|
330 | - |
|
331 | - return false; |
|
332 | - } |
|
333 | - |
|
334 | - /** |
|
335 | - * @return static |
|
336 | - */ |
|
337 | - abstract public function folded(): self; |
|
338 | - |
|
339 | - /** |
|
340 | - * @return static |
|
341 | - */ |
|
342 | - public function ignoreCase(): self |
|
343 | - { |
|
344 | - $str = clone $this; |
|
345 | - $str->ignoreCase = true; |
|
346 | - |
|
347 | - return $str; |
|
348 | - } |
|
349 | - |
|
350 | - /** |
|
351 | - * @param string|string[] $needle |
|
352 | - */ |
|
353 | - public function indexOf($needle, int $offset = 0): ?int |
|
354 | - { |
|
355 | - if (!\is_array($needle) && !$needle instanceof \Traversable) { |
|
356 | - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
357 | - } |
|
358 | - |
|
359 | - $i = \PHP_INT_MAX; |
|
360 | - |
|
361 | - foreach ($needle as $n) { |
|
362 | - $j = $this->indexOf((string) $n, $offset); |
|
363 | - |
|
364 | - if (null !== $j && $j < $i) { |
|
365 | - $i = $j; |
|
366 | - } |
|
367 | - } |
|
368 | - |
|
369 | - return \PHP_INT_MAX === $i ? null : $i; |
|
370 | - } |
|
371 | - |
|
372 | - /** |
|
373 | - * @param string|string[] $needle |
|
374 | - */ |
|
375 | - public function indexOfLast($needle, int $offset = 0): ?int |
|
376 | - { |
|
377 | - if (!\is_array($needle) && !$needle instanceof \Traversable) { |
|
378 | - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
379 | - } |
|
380 | - |
|
381 | - $i = null; |
|
382 | - |
|
383 | - foreach ($needle as $n) { |
|
384 | - $j = $this->indexOfLast((string) $n, $offset); |
|
385 | - |
|
386 | - if (null !== $j && $j >= $i) { |
|
387 | - $i = $offset = $j; |
|
388 | - } |
|
389 | - } |
|
390 | - |
|
391 | - return $i; |
|
392 | - } |
|
393 | - |
|
394 | - public function isEmpty(): bool |
|
395 | - { |
|
396 | - return '' === $this->string; |
|
397 | - } |
|
398 | - |
|
399 | - /** |
|
400 | - * @return static |
|
401 | - */ |
|
402 | - abstract public function join(array $strings, string $lastGlue = null): self; |
|
403 | - |
|
404 | - public function jsonSerialize(): string |
|
405 | - { |
|
406 | - return $this->string; |
|
407 | - } |
|
408 | - |
|
409 | - abstract public function length(): int; |
|
410 | - |
|
411 | - /** |
|
412 | - * @return static |
|
413 | - */ |
|
414 | - abstract public function lower(): self; |
|
415 | - |
|
416 | - /** |
|
417 | - * Matches the string using a regular expression. |
|
418 | - * |
|
419 | - * Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the regular expression. |
|
420 | - * |
|
421 | - * @return array All matches in a multi-dimensional array ordered according to flags |
|
422 | - */ |
|
423 | - abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array; |
|
424 | - |
|
425 | - /** |
|
426 | - * @return static |
|
427 | - */ |
|
428 | - abstract public function padBoth(int $length, string $padStr = ' '): self; |
|
429 | - |
|
430 | - /** |
|
431 | - * @return static |
|
432 | - */ |
|
433 | - abstract public function padEnd(int $length, string $padStr = ' '): self; |
|
434 | - |
|
435 | - /** |
|
436 | - * @return static |
|
437 | - */ |
|
438 | - abstract public function padStart(int $length, string $padStr = ' '): self; |
|
439 | - |
|
440 | - /** |
|
441 | - * @return static |
|
442 | - */ |
|
443 | - abstract public function prepend(string ...$prefix): self; |
|
444 | - |
|
445 | - /** |
|
446 | - * @return static |
|
447 | - */ |
|
448 | - public function repeat(int $multiplier): self |
|
449 | - { |
|
450 | - if (0 > $multiplier) { |
|
451 | - throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier)); |
|
452 | - } |
|
453 | - |
|
454 | - $str = clone $this; |
|
455 | - $str->string = str_repeat($str->string, $multiplier); |
|
456 | - |
|
457 | - return $str; |
|
458 | - } |
|
459 | - |
|
460 | - /** |
|
461 | - * @return static |
|
462 | - */ |
|
463 | - abstract public function replace(string $from, string $to): self; |
|
464 | - |
|
465 | - /** |
|
466 | - * @param string|callable $to |
|
467 | - * |
|
468 | - * @return static |
|
469 | - */ |
|
470 | - abstract public function replaceMatches(string $fromRegexp, $to): self; |
|
471 | - |
|
472 | - /** |
|
473 | - * @return static |
|
474 | - */ |
|
475 | - abstract public function reverse(): self; |
|
476 | - |
|
477 | - /** |
|
478 | - * @return static |
|
479 | - */ |
|
480 | - abstract public function slice(int $start = 0, int $length = null): self; |
|
481 | - |
|
482 | - /** |
|
483 | - * @return static |
|
484 | - */ |
|
485 | - abstract public function snake(): self; |
|
486 | - |
|
487 | - /** |
|
488 | - * @return static |
|
489 | - */ |
|
490 | - abstract public function splice(string $replacement, int $start = 0, int $length = null): self; |
|
491 | - |
|
492 | - /** |
|
493 | - * @return static[] |
|
494 | - */ |
|
495 | - public function split(string $delimiter, int $limit = null, int $flags = null): array |
|
496 | - { |
|
497 | - if (null === $flags) { |
|
498 | - throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.'); |
|
499 | - } |
|
500 | - |
|
501 | - if ($this->ignoreCase) { |
|
502 | - $delimiter .= 'i'; |
|
503 | - } |
|
504 | - |
|
505 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
506 | - |
|
507 | - try { |
|
508 | - if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) { |
|
509 | - $lastError = preg_last_error(); |
|
510 | - |
|
511 | - foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
|
512 | - if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
|
513 | - throw new RuntimeException('Splitting failed with '.$k.'.'); |
|
514 | - } |
|
515 | - } |
|
516 | - |
|
517 | - throw new RuntimeException('Splitting failed with unknown error code.'); |
|
518 | - } |
|
519 | - } finally { |
|
520 | - restore_error_handler(); |
|
521 | - } |
|
522 | - |
|
523 | - $str = clone $this; |
|
524 | - |
|
525 | - if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) { |
|
526 | - foreach ($chunks as &$chunk) { |
|
527 | - $str->string = $chunk[0]; |
|
528 | - $chunk[0] = clone $str; |
|
529 | - } |
|
530 | - } else { |
|
531 | - foreach ($chunks as &$chunk) { |
|
532 | - $str->string = $chunk; |
|
533 | - $chunk = clone $str; |
|
534 | - } |
|
535 | - } |
|
536 | - |
|
537 | - return $chunks; |
|
538 | - } |
|
539 | - |
|
540 | - /** |
|
541 | - * @param string|string[] $prefix |
|
542 | - */ |
|
543 | - public function startsWith($prefix): bool |
|
544 | - { |
|
545 | - if (!\is_array($prefix) && !$prefix instanceof \Traversable) { |
|
546 | - throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
547 | - } |
|
548 | - |
|
549 | - foreach ($prefix as $prefix) { |
|
550 | - if ($this->startsWith((string) $prefix)) { |
|
551 | - return true; |
|
552 | - } |
|
553 | - } |
|
554 | - |
|
555 | - return false; |
|
556 | - } |
|
557 | - |
|
558 | - /** |
|
559 | - * @return static |
|
560 | - */ |
|
561 | - abstract public function title(bool $allWords = false): self; |
|
562 | - |
|
563 | - public function toByteString(string $toEncoding = null): ByteString |
|
564 | - { |
|
565 | - $b = new ByteString(); |
|
566 | - |
|
567 | - $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding; |
|
568 | - |
|
569 | - if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') { |
|
570 | - $b->string = $this->string; |
|
571 | - |
|
572 | - return $b; |
|
573 | - } |
|
574 | - |
|
575 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
576 | - |
|
577 | - try { |
|
578 | - try { |
|
579 | - $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8'); |
|
580 | - } catch (InvalidArgumentException $e) { |
|
581 | - if (!\function_exists('iconv')) { |
|
582 | - throw $e; |
|
583 | - } |
|
584 | - |
|
585 | - $b->string = iconv('UTF-8', $toEncoding, $this->string); |
|
586 | - } |
|
587 | - } finally { |
|
588 | - restore_error_handler(); |
|
589 | - } |
|
590 | - |
|
591 | - return $b; |
|
592 | - } |
|
593 | - |
|
594 | - public function toCodePointString(): CodePointString |
|
595 | - { |
|
596 | - return new CodePointString($this->string); |
|
597 | - } |
|
598 | - |
|
599 | - public function toString(): string |
|
600 | - { |
|
601 | - return $this->string; |
|
602 | - } |
|
603 | - |
|
604 | - public function toUnicodeString(): UnicodeString |
|
605 | - { |
|
606 | - return new UnicodeString($this->string); |
|
607 | - } |
|
608 | - |
|
609 | - /** |
|
610 | - * @return static |
|
611 | - */ |
|
612 | - abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self; |
|
613 | - |
|
614 | - /** |
|
615 | - * @return static |
|
616 | - */ |
|
617 | - abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self; |
|
618 | - |
|
619 | - /** |
|
620 | - * @return static |
|
621 | - */ |
|
622 | - abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self; |
|
623 | - |
|
624 | - /** |
|
625 | - * @return static |
|
626 | - */ |
|
627 | - public function truncate(int $length, string $ellipsis = '', bool $cut = true): self |
|
628 | - { |
|
629 | - $stringLength = $this->length(); |
|
630 | - |
|
631 | - if ($stringLength <= $length) { |
|
632 | - return clone $this; |
|
633 | - } |
|
634 | - |
|
635 | - $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0; |
|
636 | - |
|
637 | - if ($length < $ellipsisLength) { |
|
638 | - $ellipsisLength = 0; |
|
639 | - } |
|
640 | - |
|
641 | - if (!$cut) { |
|
642 | - if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) { |
|
643 | - return clone $this; |
|
644 | - } |
|
645 | - |
|
646 | - $length += $ellipsisLength; |
|
647 | - } |
|
648 | - |
|
649 | - $str = $this->slice(0, $length - $ellipsisLength); |
|
650 | - |
|
651 | - return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str; |
|
652 | - } |
|
653 | - |
|
654 | - /** |
|
655 | - * @return static |
|
656 | - */ |
|
657 | - abstract public function upper(): self; |
|
658 | - |
|
659 | - /** |
|
660 | - * Returns the printable length on a terminal. |
|
661 | - */ |
|
662 | - abstract public function width(bool $ignoreAnsiDecoration = true): int; |
|
663 | - |
|
664 | - /** |
|
665 | - * @return static |
|
666 | - */ |
|
667 | - public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self |
|
668 | - { |
|
669 | - $lines = '' !== $break ? $this->split($break) : [clone $this]; |
|
670 | - $chars = []; |
|
671 | - $mask = ''; |
|
672 | - |
|
673 | - if (1 === \count($lines) && '' === $lines[0]->string) { |
|
674 | - return $lines[0]; |
|
675 | - } |
|
676 | - |
|
677 | - foreach ($lines as $i => $line) { |
|
678 | - if ($i) { |
|
679 | - $chars[] = $break; |
|
680 | - $mask .= '#'; |
|
681 | - } |
|
682 | - |
|
683 | - foreach ($line->chunk() as $char) { |
|
684 | - $chars[] = $char->string; |
|
685 | - $mask .= ' ' === $char->string ? ' ' : '?'; |
|
686 | - } |
|
687 | - } |
|
688 | - |
|
689 | - $string = ''; |
|
690 | - $j = 0; |
|
691 | - $b = $i = -1; |
|
692 | - $mask = wordwrap($mask, $width, '#', $cut); |
|
693 | - |
|
694 | - while (false !== $b = strpos($mask, '#', $b + 1)) { |
|
695 | - for (++$i; $i < $b; ++$i) { |
|
696 | - $string .= $chars[$j]; |
|
697 | - unset($chars[$j++]); |
|
698 | - } |
|
699 | - |
|
700 | - if ($break === $chars[$j] || ' ' === $chars[$j]) { |
|
701 | - unset($chars[$j++]); |
|
702 | - } |
|
703 | - |
|
704 | - $string .= $break; |
|
705 | - } |
|
706 | - |
|
707 | - $str = clone $this; |
|
708 | - $str->string = $string.implode('', $chars); |
|
709 | - |
|
710 | - return $str; |
|
711 | - } |
|
712 | - |
|
713 | - public function __sleep(): array |
|
714 | - { |
|
715 | - return ['string']; |
|
716 | - } |
|
717 | - |
|
718 | - public function __clone() |
|
719 | - { |
|
720 | - $this->ignoreCase = false; |
|
721 | - } |
|
722 | - |
|
723 | - public function __toString(): string |
|
724 | - { |
|
725 | - return $this->string; |
|
726 | - } |
|
32 | + public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER; |
|
33 | + public const PREG_SET_ORDER = \PREG_SET_ORDER; |
|
34 | + public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE; |
|
35 | + public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL; |
|
36 | + |
|
37 | + public const PREG_SPLIT = 0; |
|
38 | + public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY; |
|
39 | + public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE; |
|
40 | + public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE; |
|
41 | + |
|
42 | + protected $string = ''; |
|
43 | + protected $ignoreCase = false; |
|
44 | + |
|
45 | + abstract public function __construct(string $string = ''); |
|
46 | + |
|
47 | + /** |
|
48 | + * Unwraps instances of AbstractString back to strings. |
|
49 | + * |
|
50 | + * @return string[]|array |
|
51 | + */ |
|
52 | + public static function unwrap(array $values): array |
|
53 | + { |
|
54 | + foreach ($values as $k => $v) { |
|
55 | + if ($v instanceof self) { |
|
56 | + $values[$k] = $v->__toString(); |
|
57 | + } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) { |
|
58 | + $values[$k] = $v; |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + return $values; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * Wraps (and normalizes) strings in instances of AbstractString. |
|
67 | + * |
|
68 | + * @return static[]|array |
|
69 | + */ |
|
70 | + public static function wrap(array $values): array |
|
71 | + { |
|
72 | + $i = 0; |
|
73 | + $keys = null; |
|
74 | + |
|
75 | + foreach ($values as $k => $v) { |
|
76 | + if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) { |
|
77 | + $keys = $keys ?? array_keys($values); |
|
78 | + $keys[$i] = $j; |
|
79 | + } |
|
80 | + |
|
81 | + if (\is_string($v)) { |
|
82 | + $values[$k] = new static($v); |
|
83 | + } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) { |
|
84 | + $values[$k] = $v; |
|
85 | + } |
|
86 | + |
|
87 | + ++$i; |
|
88 | + } |
|
89 | + |
|
90 | + return null !== $keys ? array_combine($keys, $values) : $values; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * @param string|string[] $needle |
|
95 | + * |
|
96 | + * @return static |
|
97 | + */ |
|
98 | + public function after($needle, bool $includeNeedle = false, int $offset = 0): self |
|
99 | + { |
|
100 | + $str = clone $this; |
|
101 | + $i = \PHP_INT_MAX; |
|
102 | + |
|
103 | + foreach ((array) $needle as $n) { |
|
104 | + $n = (string) $n; |
|
105 | + $j = $this->indexOf($n, $offset); |
|
106 | + |
|
107 | + if (null !== $j && $j < $i) { |
|
108 | + $i = $j; |
|
109 | + $str->string = $n; |
|
110 | + } |
|
111 | + } |
|
112 | + |
|
113 | + if (\PHP_INT_MAX === $i) { |
|
114 | + return $str; |
|
115 | + } |
|
116 | + |
|
117 | + if (!$includeNeedle) { |
|
118 | + $i += $str->length(); |
|
119 | + } |
|
120 | + |
|
121 | + return $this->slice($i); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @param string|string[] $needle |
|
126 | + * |
|
127 | + * @return static |
|
128 | + */ |
|
129 | + public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self |
|
130 | + { |
|
131 | + $str = clone $this; |
|
132 | + $i = null; |
|
133 | + |
|
134 | + foreach ((array) $needle as $n) { |
|
135 | + $n = (string) $n; |
|
136 | + $j = $this->indexOfLast($n, $offset); |
|
137 | + |
|
138 | + if (null !== $j && $j >= $i) { |
|
139 | + $i = $offset = $j; |
|
140 | + $str->string = $n; |
|
141 | + } |
|
142 | + } |
|
143 | + |
|
144 | + if (null === $i) { |
|
145 | + return $str; |
|
146 | + } |
|
147 | + |
|
148 | + if (!$includeNeedle) { |
|
149 | + $i += $str->length(); |
|
150 | + } |
|
151 | + |
|
152 | + return $this->slice($i); |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * @return static |
|
157 | + */ |
|
158 | + abstract public function append(string ...$suffix): self; |
|
159 | + |
|
160 | + /** |
|
161 | + * @param string|string[] $needle |
|
162 | + * |
|
163 | + * @return static |
|
164 | + */ |
|
165 | + public function before($needle, bool $includeNeedle = false, int $offset = 0): self |
|
166 | + { |
|
167 | + $str = clone $this; |
|
168 | + $i = \PHP_INT_MAX; |
|
169 | + |
|
170 | + foreach ((array) $needle as $n) { |
|
171 | + $n = (string) $n; |
|
172 | + $j = $this->indexOf($n, $offset); |
|
173 | + |
|
174 | + if (null !== $j && $j < $i) { |
|
175 | + $i = $j; |
|
176 | + $str->string = $n; |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + if (\PHP_INT_MAX === $i) { |
|
181 | + return $str; |
|
182 | + } |
|
183 | + |
|
184 | + if ($includeNeedle) { |
|
185 | + $i += $str->length(); |
|
186 | + } |
|
187 | + |
|
188 | + return $this->slice(0, $i); |
|
189 | + } |
|
190 | + |
|
191 | + /** |
|
192 | + * @param string|string[] $needle |
|
193 | + * |
|
194 | + * @return static |
|
195 | + */ |
|
196 | + public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self |
|
197 | + { |
|
198 | + $str = clone $this; |
|
199 | + $i = null; |
|
200 | + |
|
201 | + foreach ((array) $needle as $n) { |
|
202 | + $n = (string) $n; |
|
203 | + $j = $this->indexOfLast($n, $offset); |
|
204 | + |
|
205 | + if (null !== $j && $j >= $i) { |
|
206 | + $i = $offset = $j; |
|
207 | + $str->string = $n; |
|
208 | + } |
|
209 | + } |
|
210 | + |
|
211 | + if (null === $i) { |
|
212 | + return $str; |
|
213 | + } |
|
214 | + |
|
215 | + if ($includeNeedle) { |
|
216 | + $i += $str->length(); |
|
217 | + } |
|
218 | + |
|
219 | + return $this->slice(0, $i); |
|
220 | + } |
|
221 | + |
|
222 | + /** |
|
223 | + * @return int[] |
|
224 | + */ |
|
225 | + public function bytesAt(int $offset): array |
|
226 | + { |
|
227 | + $str = $this->slice($offset, 1); |
|
228 | + |
|
229 | + return '' === $str->string ? [] : array_values(unpack('C*', $str->string)); |
|
230 | + } |
|
231 | + |
|
232 | + /** |
|
233 | + * @return static |
|
234 | + */ |
|
235 | + abstract public function camel(): self; |
|
236 | + |
|
237 | + /** |
|
238 | + * @return static[] |
|
239 | + */ |
|
240 | + abstract public function chunk(int $length = 1): array; |
|
241 | + |
|
242 | + /** |
|
243 | + * @return static |
|
244 | + */ |
|
245 | + public function collapseWhitespace(): self |
|
246 | + { |
|
247 | + $str = clone $this; |
|
248 | + $str->string = trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $str->string)); |
|
249 | + |
|
250 | + return $str; |
|
251 | + } |
|
252 | + |
|
253 | + /** |
|
254 | + * @param string|string[] $needle |
|
255 | + */ |
|
256 | + public function containsAny($needle): bool |
|
257 | + { |
|
258 | + return null !== $this->indexOf($needle); |
|
259 | + } |
|
260 | + |
|
261 | + /** |
|
262 | + * @param string|string[] $suffix |
|
263 | + */ |
|
264 | + public function endsWith($suffix): bool |
|
265 | + { |
|
266 | + if (!\is_array($suffix) && !$suffix instanceof \Traversable) { |
|
267 | + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
268 | + } |
|
269 | + |
|
270 | + foreach ($suffix as $s) { |
|
271 | + if ($this->endsWith((string) $s)) { |
|
272 | + return true; |
|
273 | + } |
|
274 | + } |
|
275 | + |
|
276 | + return false; |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * @return static |
|
281 | + */ |
|
282 | + public function ensureEnd(string $suffix): self |
|
283 | + { |
|
284 | + if (!$this->endsWith($suffix)) { |
|
285 | + return $this->append($suffix); |
|
286 | + } |
|
287 | + |
|
288 | + $suffix = preg_quote($suffix); |
|
289 | + $regex = '{('.$suffix.')(?:'.$suffix.')++$}D'; |
|
290 | + |
|
291 | + return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1'); |
|
292 | + } |
|
293 | + |
|
294 | + /** |
|
295 | + * @return static |
|
296 | + */ |
|
297 | + public function ensureStart(string $prefix): self |
|
298 | + { |
|
299 | + $prefix = new static($prefix); |
|
300 | + |
|
301 | + if (!$this->startsWith($prefix)) { |
|
302 | + return $this->prepend($prefix); |
|
303 | + } |
|
304 | + |
|
305 | + $str = clone $this; |
|
306 | + $i = $prefixLen = $prefix->length(); |
|
307 | + |
|
308 | + while ($this->indexOf($prefix, $i) === $i) { |
|
309 | + $str = $str->slice($prefixLen); |
|
310 | + $i += $prefixLen; |
|
311 | + } |
|
312 | + |
|
313 | + return $str; |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * @param string|string[] $string |
|
318 | + */ |
|
319 | + public function equalsTo($string): bool |
|
320 | + { |
|
321 | + if (!\is_array($string) && !$string instanceof \Traversable) { |
|
322 | + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
323 | + } |
|
324 | + |
|
325 | + foreach ($string as $s) { |
|
326 | + if ($this->equalsTo((string) $s)) { |
|
327 | + return true; |
|
328 | + } |
|
329 | + } |
|
330 | + |
|
331 | + return false; |
|
332 | + } |
|
333 | + |
|
334 | + /** |
|
335 | + * @return static |
|
336 | + */ |
|
337 | + abstract public function folded(): self; |
|
338 | + |
|
339 | + /** |
|
340 | + * @return static |
|
341 | + */ |
|
342 | + public function ignoreCase(): self |
|
343 | + { |
|
344 | + $str = clone $this; |
|
345 | + $str->ignoreCase = true; |
|
346 | + |
|
347 | + return $str; |
|
348 | + } |
|
349 | + |
|
350 | + /** |
|
351 | + * @param string|string[] $needle |
|
352 | + */ |
|
353 | + public function indexOf($needle, int $offset = 0): ?int |
|
354 | + { |
|
355 | + if (!\is_array($needle) && !$needle instanceof \Traversable) { |
|
356 | + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
357 | + } |
|
358 | + |
|
359 | + $i = \PHP_INT_MAX; |
|
360 | + |
|
361 | + foreach ($needle as $n) { |
|
362 | + $j = $this->indexOf((string) $n, $offset); |
|
363 | + |
|
364 | + if (null !== $j && $j < $i) { |
|
365 | + $i = $j; |
|
366 | + } |
|
367 | + } |
|
368 | + |
|
369 | + return \PHP_INT_MAX === $i ? null : $i; |
|
370 | + } |
|
371 | + |
|
372 | + /** |
|
373 | + * @param string|string[] $needle |
|
374 | + */ |
|
375 | + public function indexOfLast($needle, int $offset = 0): ?int |
|
376 | + { |
|
377 | + if (!\is_array($needle) && !$needle instanceof \Traversable) { |
|
378 | + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
379 | + } |
|
380 | + |
|
381 | + $i = null; |
|
382 | + |
|
383 | + foreach ($needle as $n) { |
|
384 | + $j = $this->indexOfLast((string) $n, $offset); |
|
385 | + |
|
386 | + if (null !== $j && $j >= $i) { |
|
387 | + $i = $offset = $j; |
|
388 | + } |
|
389 | + } |
|
390 | + |
|
391 | + return $i; |
|
392 | + } |
|
393 | + |
|
394 | + public function isEmpty(): bool |
|
395 | + { |
|
396 | + return '' === $this->string; |
|
397 | + } |
|
398 | + |
|
399 | + /** |
|
400 | + * @return static |
|
401 | + */ |
|
402 | + abstract public function join(array $strings, string $lastGlue = null): self; |
|
403 | + |
|
404 | + public function jsonSerialize(): string |
|
405 | + { |
|
406 | + return $this->string; |
|
407 | + } |
|
408 | + |
|
409 | + abstract public function length(): int; |
|
410 | + |
|
411 | + /** |
|
412 | + * @return static |
|
413 | + */ |
|
414 | + abstract public function lower(): self; |
|
415 | + |
|
416 | + /** |
|
417 | + * Matches the string using a regular expression. |
|
418 | + * |
|
419 | + * Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the regular expression. |
|
420 | + * |
|
421 | + * @return array All matches in a multi-dimensional array ordered according to flags |
|
422 | + */ |
|
423 | + abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array; |
|
424 | + |
|
425 | + /** |
|
426 | + * @return static |
|
427 | + */ |
|
428 | + abstract public function padBoth(int $length, string $padStr = ' '): self; |
|
429 | + |
|
430 | + /** |
|
431 | + * @return static |
|
432 | + */ |
|
433 | + abstract public function padEnd(int $length, string $padStr = ' '): self; |
|
434 | + |
|
435 | + /** |
|
436 | + * @return static |
|
437 | + */ |
|
438 | + abstract public function padStart(int $length, string $padStr = ' '): self; |
|
439 | + |
|
440 | + /** |
|
441 | + * @return static |
|
442 | + */ |
|
443 | + abstract public function prepend(string ...$prefix): self; |
|
444 | + |
|
445 | + /** |
|
446 | + * @return static |
|
447 | + */ |
|
448 | + public function repeat(int $multiplier): self |
|
449 | + { |
|
450 | + if (0 > $multiplier) { |
|
451 | + throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier)); |
|
452 | + } |
|
453 | + |
|
454 | + $str = clone $this; |
|
455 | + $str->string = str_repeat($str->string, $multiplier); |
|
456 | + |
|
457 | + return $str; |
|
458 | + } |
|
459 | + |
|
460 | + /** |
|
461 | + * @return static |
|
462 | + */ |
|
463 | + abstract public function replace(string $from, string $to): self; |
|
464 | + |
|
465 | + /** |
|
466 | + * @param string|callable $to |
|
467 | + * |
|
468 | + * @return static |
|
469 | + */ |
|
470 | + abstract public function replaceMatches(string $fromRegexp, $to): self; |
|
471 | + |
|
472 | + /** |
|
473 | + * @return static |
|
474 | + */ |
|
475 | + abstract public function reverse(): self; |
|
476 | + |
|
477 | + /** |
|
478 | + * @return static |
|
479 | + */ |
|
480 | + abstract public function slice(int $start = 0, int $length = null): self; |
|
481 | + |
|
482 | + /** |
|
483 | + * @return static |
|
484 | + */ |
|
485 | + abstract public function snake(): self; |
|
486 | + |
|
487 | + /** |
|
488 | + * @return static |
|
489 | + */ |
|
490 | + abstract public function splice(string $replacement, int $start = 0, int $length = null): self; |
|
491 | + |
|
492 | + /** |
|
493 | + * @return static[] |
|
494 | + */ |
|
495 | + public function split(string $delimiter, int $limit = null, int $flags = null): array |
|
496 | + { |
|
497 | + if (null === $flags) { |
|
498 | + throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.'); |
|
499 | + } |
|
500 | + |
|
501 | + if ($this->ignoreCase) { |
|
502 | + $delimiter .= 'i'; |
|
503 | + } |
|
504 | + |
|
505 | + set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
506 | + |
|
507 | + try { |
|
508 | + if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) { |
|
509 | + $lastError = preg_last_error(); |
|
510 | + |
|
511 | + foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
|
512 | + if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
|
513 | + throw new RuntimeException('Splitting failed with '.$k.'.'); |
|
514 | + } |
|
515 | + } |
|
516 | + |
|
517 | + throw new RuntimeException('Splitting failed with unknown error code.'); |
|
518 | + } |
|
519 | + } finally { |
|
520 | + restore_error_handler(); |
|
521 | + } |
|
522 | + |
|
523 | + $str = clone $this; |
|
524 | + |
|
525 | + if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) { |
|
526 | + foreach ($chunks as &$chunk) { |
|
527 | + $str->string = $chunk[0]; |
|
528 | + $chunk[0] = clone $str; |
|
529 | + } |
|
530 | + } else { |
|
531 | + foreach ($chunks as &$chunk) { |
|
532 | + $str->string = $chunk; |
|
533 | + $chunk = clone $str; |
|
534 | + } |
|
535 | + } |
|
536 | + |
|
537 | + return $chunks; |
|
538 | + } |
|
539 | + |
|
540 | + /** |
|
541 | + * @param string|string[] $prefix |
|
542 | + */ |
|
543 | + public function startsWith($prefix): bool |
|
544 | + { |
|
545 | + if (!\is_array($prefix) && !$prefix instanceof \Traversable) { |
|
546 | + throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class)); |
|
547 | + } |
|
548 | + |
|
549 | + foreach ($prefix as $prefix) { |
|
550 | + if ($this->startsWith((string) $prefix)) { |
|
551 | + return true; |
|
552 | + } |
|
553 | + } |
|
554 | + |
|
555 | + return false; |
|
556 | + } |
|
557 | + |
|
558 | + /** |
|
559 | + * @return static |
|
560 | + */ |
|
561 | + abstract public function title(bool $allWords = false): self; |
|
562 | + |
|
563 | + public function toByteString(string $toEncoding = null): ByteString |
|
564 | + { |
|
565 | + $b = new ByteString(); |
|
566 | + |
|
567 | + $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding; |
|
568 | + |
|
569 | + if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') { |
|
570 | + $b->string = $this->string; |
|
571 | + |
|
572 | + return $b; |
|
573 | + } |
|
574 | + |
|
575 | + set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
576 | + |
|
577 | + try { |
|
578 | + try { |
|
579 | + $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8'); |
|
580 | + } catch (InvalidArgumentException $e) { |
|
581 | + if (!\function_exists('iconv')) { |
|
582 | + throw $e; |
|
583 | + } |
|
584 | + |
|
585 | + $b->string = iconv('UTF-8', $toEncoding, $this->string); |
|
586 | + } |
|
587 | + } finally { |
|
588 | + restore_error_handler(); |
|
589 | + } |
|
590 | + |
|
591 | + return $b; |
|
592 | + } |
|
593 | + |
|
594 | + public function toCodePointString(): CodePointString |
|
595 | + { |
|
596 | + return new CodePointString($this->string); |
|
597 | + } |
|
598 | + |
|
599 | + public function toString(): string |
|
600 | + { |
|
601 | + return $this->string; |
|
602 | + } |
|
603 | + |
|
604 | + public function toUnicodeString(): UnicodeString |
|
605 | + { |
|
606 | + return new UnicodeString($this->string); |
|
607 | + } |
|
608 | + |
|
609 | + /** |
|
610 | + * @return static |
|
611 | + */ |
|
612 | + abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self; |
|
613 | + |
|
614 | + /** |
|
615 | + * @return static |
|
616 | + */ |
|
617 | + abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self; |
|
618 | + |
|
619 | + /** |
|
620 | + * @return static |
|
621 | + */ |
|
622 | + abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self; |
|
623 | + |
|
624 | + /** |
|
625 | + * @return static |
|
626 | + */ |
|
627 | + public function truncate(int $length, string $ellipsis = '', bool $cut = true): self |
|
628 | + { |
|
629 | + $stringLength = $this->length(); |
|
630 | + |
|
631 | + if ($stringLength <= $length) { |
|
632 | + return clone $this; |
|
633 | + } |
|
634 | + |
|
635 | + $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0; |
|
636 | + |
|
637 | + if ($length < $ellipsisLength) { |
|
638 | + $ellipsisLength = 0; |
|
639 | + } |
|
640 | + |
|
641 | + if (!$cut) { |
|
642 | + if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) { |
|
643 | + return clone $this; |
|
644 | + } |
|
645 | + |
|
646 | + $length += $ellipsisLength; |
|
647 | + } |
|
648 | + |
|
649 | + $str = $this->slice(0, $length - $ellipsisLength); |
|
650 | + |
|
651 | + return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str; |
|
652 | + } |
|
653 | + |
|
654 | + /** |
|
655 | + * @return static |
|
656 | + */ |
|
657 | + abstract public function upper(): self; |
|
658 | + |
|
659 | + /** |
|
660 | + * Returns the printable length on a terminal. |
|
661 | + */ |
|
662 | + abstract public function width(bool $ignoreAnsiDecoration = true): int; |
|
663 | + |
|
664 | + /** |
|
665 | + * @return static |
|
666 | + */ |
|
667 | + public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self |
|
668 | + { |
|
669 | + $lines = '' !== $break ? $this->split($break) : [clone $this]; |
|
670 | + $chars = []; |
|
671 | + $mask = ''; |
|
672 | + |
|
673 | + if (1 === \count($lines) && '' === $lines[0]->string) { |
|
674 | + return $lines[0]; |
|
675 | + } |
|
676 | + |
|
677 | + foreach ($lines as $i => $line) { |
|
678 | + if ($i) { |
|
679 | + $chars[] = $break; |
|
680 | + $mask .= '#'; |
|
681 | + } |
|
682 | + |
|
683 | + foreach ($line->chunk() as $char) { |
|
684 | + $chars[] = $char->string; |
|
685 | + $mask .= ' ' === $char->string ? ' ' : '?'; |
|
686 | + } |
|
687 | + } |
|
688 | + |
|
689 | + $string = ''; |
|
690 | + $j = 0; |
|
691 | + $b = $i = -1; |
|
692 | + $mask = wordwrap($mask, $width, '#', $cut); |
|
693 | + |
|
694 | + while (false !== $b = strpos($mask, '#', $b + 1)) { |
|
695 | + for (++$i; $i < $b; ++$i) { |
|
696 | + $string .= $chars[$j]; |
|
697 | + unset($chars[$j++]); |
|
698 | + } |
|
699 | + |
|
700 | + if ($break === $chars[$j] || ' ' === $chars[$j]) { |
|
701 | + unset($chars[$j++]); |
|
702 | + } |
|
703 | + |
|
704 | + $string .= $break; |
|
705 | + } |
|
706 | + |
|
707 | + $str = clone $this; |
|
708 | + $str->string = $string.implode('', $chars); |
|
709 | + |
|
710 | + return $str; |
|
711 | + } |
|
712 | + |
|
713 | + public function __sleep(): array |
|
714 | + { |
|
715 | + return ['string']; |
|
716 | + } |
|
717 | + |
|
718 | + public function __clone() |
|
719 | + { |
|
720 | + $this->ignoreCase = false; |
|
721 | + } |
|
722 | + |
|
723 | + public function __toString(): string |
|
724 | + { |
|
725 | + return $this->string; |
|
726 | + } |
|
727 | 727 | } |
@@ -12,27 +12,27 @@ |
||
12 | 12 | namespace Symfony\Component\String; |
13 | 13 | |
14 | 14 | if (!\function_exists(u::class)) { |
15 | - function u(?string $string = ''): UnicodeString |
|
16 | - { |
|
17 | - return new UnicodeString($string ?? ''); |
|
18 | - } |
|
15 | + function u(?string $string = ''): UnicodeString |
|
16 | + { |
|
17 | + return new UnicodeString($string ?? ''); |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!\function_exists(b::class)) { |
22 | - function b(?string $string = ''): ByteString |
|
23 | - { |
|
24 | - return new ByteString($string ?? ''); |
|
25 | - } |
|
22 | + function b(?string $string = ''): ByteString |
|
23 | + { |
|
24 | + return new ByteString($string ?? ''); |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | if (!\function_exists(s::class)) { |
29 | - /** |
|
30 | - * @return UnicodeString|ByteString |
|
31 | - */ |
|
32 | - function s(?string $string = ''): AbstractString |
|
33 | - { |
|
34 | - $string = $string ?? ''; |
|
29 | + /** |
|
30 | + * @return UnicodeString|ByteString |
|
31 | + */ |
|
32 | + function s(?string $string = ''): AbstractString |
|
33 | + { |
|
34 | + $string = $string ?? ''; |
|
35 | 35 | |
36 | - return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string); |
|
37 | - } |
|
36 | + return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string); |
|
37 | + } |
|
38 | 38 | } |
@@ -8,1332 +8,1332 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | return [ |
11 | - [ |
|
12 | - 768, |
|
13 | - 879, |
|
14 | - ], |
|
15 | - [ |
|
16 | - 1155, |
|
17 | - 1159, |
|
18 | - ], |
|
19 | - [ |
|
20 | - 1160, |
|
21 | - 1161, |
|
22 | - ], |
|
23 | - [ |
|
24 | - 1425, |
|
25 | - 1469, |
|
26 | - ], |
|
27 | - [ |
|
28 | - 1471, |
|
29 | - 1471, |
|
30 | - ], |
|
31 | - [ |
|
32 | - 1473, |
|
33 | - 1474, |
|
34 | - ], |
|
35 | - [ |
|
36 | - 1476, |
|
37 | - 1477, |
|
38 | - ], |
|
39 | - [ |
|
40 | - 1479, |
|
41 | - 1479, |
|
42 | - ], |
|
43 | - [ |
|
44 | - 1552, |
|
45 | - 1562, |
|
46 | - ], |
|
47 | - [ |
|
48 | - 1611, |
|
49 | - 1631, |
|
50 | - ], |
|
51 | - [ |
|
52 | - 1648, |
|
53 | - 1648, |
|
54 | - ], |
|
55 | - [ |
|
56 | - 1750, |
|
57 | - 1756, |
|
58 | - ], |
|
59 | - [ |
|
60 | - 1759, |
|
61 | - 1764, |
|
62 | - ], |
|
63 | - [ |
|
64 | - 1767, |
|
65 | - 1768, |
|
66 | - ], |
|
67 | - [ |
|
68 | - 1770, |
|
69 | - 1773, |
|
70 | - ], |
|
71 | - [ |
|
72 | - 1809, |
|
73 | - 1809, |
|
74 | - ], |
|
75 | - [ |
|
76 | - 1840, |
|
77 | - 1866, |
|
78 | - ], |
|
79 | - [ |
|
80 | - 1958, |
|
81 | - 1968, |
|
82 | - ], |
|
83 | - [ |
|
84 | - 2027, |
|
85 | - 2035, |
|
86 | - ], |
|
87 | - [ |
|
88 | - 2045, |
|
89 | - 2045, |
|
90 | - ], |
|
91 | - [ |
|
92 | - 2070, |
|
93 | - 2073, |
|
94 | - ], |
|
95 | - [ |
|
96 | - 2075, |
|
97 | - 2083, |
|
98 | - ], |
|
99 | - [ |
|
100 | - 2085, |
|
101 | - 2087, |
|
102 | - ], |
|
103 | - [ |
|
104 | - 2089, |
|
105 | - 2093, |
|
106 | - ], |
|
107 | - [ |
|
108 | - 2137, |
|
109 | - 2139, |
|
110 | - ], |
|
111 | - [ |
|
112 | - 2259, |
|
113 | - 2273, |
|
114 | - ], |
|
115 | - [ |
|
116 | - 2275, |
|
117 | - 2306, |
|
118 | - ], |
|
119 | - [ |
|
120 | - 2362, |
|
121 | - 2362, |
|
122 | - ], |
|
123 | - [ |
|
124 | - 2364, |
|
125 | - 2364, |
|
126 | - ], |
|
127 | - [ |
|
128 | - 2369, |
|
129 | - 2376, |
|
130 | - ], |
|
131 | - [ |
|
132 | - 2381, |
|
133 | - 2381, |
|
134 | - ], |
|
135 | - [ |
|
136 | - 2385, |
|
137 | - 2391, |
|
138 | - ], |
|
139 | - [ |
|
140 | - 2402, |
|
141 | - 2403, |
|
142 | - ], |
|
143 | - [ |
|
144 | - 2433, |
|
145 | - 2433, |
|
146 | - ], |
|
147 | - [ |
|
148 | - 2492, |
|
149 | - 2492, |
|
150 | - ], |
|
151 | - [ |
|
152 | - 2497, |
|
153 | - 2500, |
|
154 | - ], |
|
155 | - [ |
|
156 | - 2509, |
|
157 | - 2509, |
|
158 | - ], |
|
159 | - [ |
|
160 | - 2530, |
|
161 | - 2531, |
|
162 | - ], |
|
163 | - [ |
|
164 | - 2558, |
|
165 | - 2558, |
|
166 | - ], |
|
167 | - [ |
|
168 | - 2561, |
|
169 | - 2562, |
|
170 | - ], |
|
171 | - [ |
|
172 | - 2620, |
|
173 | - 2620, |
|
174 | - ], |
|
175 | - [ |
|
176 | - 2625, |
|
177 | - 2626, |
|
178 | - ], |
|
179 | - [ |
|
180 | - 2631, |
|
181 | - 2632, |
|
182 | - ], |
|
183 | - [ |
|
184 | - 2635, |
|
185 | - 2637, |
|
186 | - ], |
|
187 | - [ |
|
188 | - 2641, |
|
189 | - 2641, |
|
190 | - ], |
|
191 | - [ |
|
192 | - 2672, |
|
193 | - 2673, |
|
194 | - ], |
|
195 | - [ |
|
196 | - 2677, |
|
197 | - 2677, |
|
198 | - ], |
|
199 | - [ |
|
200 | - 2689, |
|
201 | - 2690, |
|
202 | - ], |
|
203 | - [ |
|
204 | - 2748, |
|
205 | - 2748, |
|
206 | - ], |
|
207 | - [ |
|
208 | - 2753, |
|
209 | - 2757, |
|
210 | - ], |
|
211 | - [ |
|
212 | - 2759, |
|
213 | - 2760, |
|
214 | - ], |
|
215 | - [ |
|
216 | - 2765, |
|
217 | - 2765, |
|
218 | - ], |
|
219 | - [ |
|
220 | - 2786, |
|
221 | - 2787, |
|
222 | - ], |
|
223 | - [ |
|
224 | - 2810, |
|
225 | - 2815, |
|
226 | - ], |
|
227 | - [ |
|
228 | - 2817, |
|
229 | - 2817, |
|
230 | - ], |
|
231 | - [ |
|
232 | - 2876, |
|
233 | - 2876, |
|
234 | - ], |
|
235 | - [ |
|
236 | - 2879, |
|
237 | - 2879, |
|
238 | - ], |
|
239 | - [ |
|
240 | - 2881, |
|
241 | - 2884, |
|
242 | - ], |
|
243 | - [ |
|
244 | - 2893, |
|
245 | - 2893, |
|
246 | - ], |
|
247 | - [ |
|
248 | - 2901, |
|
249 | - 2902, |
|
250 | - ], |
|
251 | - [ |
|
252 | - 2914, |
|
253 | - 2915, |
|
254 | - ], |
|
255 | - [ |
|
256 | - 2946, |
|
257 | - 2946, |
|
258 | - ], |
|
259 | - [ |
|
260 | - 3008, |
|
261 | - 3008, |
|
262 | - ], |
|
263 | - [ |
|
264 | - 3021, |
|
265 | - 3021, |
|
266 | - ], |
|
267 | - [ |
|
268 | - 3072, |
|
269 | - 3072, |
|
270 | - ], |
|
271 | - [ |
|
272 | - 3076, |
|
273 | - 3076, |
|
274 | - ], |
|
275 | - [ |
|
276 | - 3134, |
|
277 | - 3136, |
|
278 | - ], |
|
279 | - [ |
|
280 | - 3142, |
|
281 | - 3144, |
|
282 | - ], |
|
283 | - [ |
|
284 | - 3146, |
|
285 | - 3149, |
|
286 | - ], |
|
287 | - [ |
|
288 | - 3157, |
|
289 | - 3158, |
|
290 | - ], |
|
291 | - [ |
|
292 | - 3170, |
|
293 | - 3171, |
|
294 | - ], |
|
295 | - [ |
|
296 | - 3201, |
|
297 | - 3201, |
|
298 | - ], |
|
299 | - [ |
|
300 | - 3260, |
|
301 | - 3260, |
|
302 | - ], |
|
303 | - [ |
|
304 | - 3263, |
|
305 | - 3263, |
|
306 | - ], |
|
307 | - [ |
|
308 | - 3270, |
|
309 | - 3270, |
|
310 | - ], |
|
311 | - [ |
|
312 | - 3276, |
|
313 | - 3277, |
|
314 | - ], |
|
315 | - [ |
|
316 | - 3298, |
|
317 | - 3299, |
|
318 | - ], |
|
319 | - [ |
|
320 | - 3328, |
|
321 | - 3329, |
|
322 | - ], |
|
323 | - [ |
|
324 | - 3387, |
|
325 | - 3388, |
|
326 | - ], |
|
327 | - [ |
|
328 | - 3393, |
|
329 | - 3396, |
|
330 | - ], |
|
331 | - [ |
|
332 | - 3405, |
|
333 | - 3405, |
|
334 | - ], |
|
335 | - [ |
|
336 | - 3426, |
|
337 | - 3427, |
|
338 | - ], |
|
339 | - [ |
|
340 | - 3457, |
|
341 | - 3457, |
|
342 | - ], |
|
343 | - [ |
|
344 | - 3530, |
|
345 | - 3530, |
|
346 | - ], |
|
347 | - [ |
|
348 | - 3538, |
|
349 | - 3540, |
|
350 | - ], |
|
351 | - [ |
|
352 | - 3542, |
|
353 | - 3542, |
|
354 | - ], |
|
355 | - [ |
|
356 | - 3633, |
|
357 | - 3633, |
|
358 | - ], |
|
359 | - [ |
|
360 | - 3636, |
|
361 | - 3642, |
|
362 | - ], |
|
363 | - [ |
|
364 | - 3655, |
|
365 | - 3662, |
|
366 | - ], |
|
367 | - [ |
|
368 | - 3761, |
|
369 | - 3761, |
|
370 | - ], |
|
371 | - [ |
|
372 | - 3764, |
|
373 | - 3772, |
|
374 | - ], |
|
375 | - [ |
|
376 | - 3784, |
|
377 | - 3789, |
|
378 | - ], |
|
379 | - [ |
|
380 | - 3864, |
|
381 | - 3865, |
|
382 | - ], |
|
383 | - [ |
|
384 | - 3893, |
|
385 | - 3893, |
|
386 | - ], |
|
387 | - [ |
|
388 | - 3895, |
|
389 | - 3895, |
|
390 | - ], |
|
391 | - [ |
|
392 | - 3897, |
|
393 | - 3897, |
|
394 | - ], |
|
395 | - [ |
|
396 | - 3953, |
|
397 | - 3966, |
|
398 | - ], |
|
399 | - [ |
|
400 | - 3968, |
|
401 | - 3972, |
|
402 | - ], |
|
403 | - [ |
|
404 | - 3974, |
|
405 | - 3975, |
|
406 | - ], |
|
407 | - [ |
|
408 | - 3981, |
|
409 | - 3991, |
|
410 | - ], |
|
411 | - [ |
|
412 | - 3993, |
|
413 | - 4028, |
|
414 | - ], |
|
415 | - [ |
|
416 | - 4038, |
|
417 | - 4038, |
|
418 | - ], |
|
419 | - [ |
|
420 | - 4141, |
|
421 | - 4144, |
|
422 | - ], |
|
423 | - [ |
|
424 | - 4146, |
|
425 | - 4151, |
|
426 | - ], |
|
427 | - [ |
|
428 | - 4153, |
|
429 | - 4154, |
|
430 | - ], |
|
431 | - [ |
|
432 | - 4157, |
|
433 | - 4158, |
|
434 | - ], |
|
435 | - [ |
|
436 | - 4184, |
|
437 | - 4185, |
|
438 | - ], |
|
439 | - [ |
|
440 | - 4190, |
|
441 | - 4192, |
|
442 | - ], |
|
443 | - [ |
|
444 | - 4209, |
|
445 | - 4212, |
|
446 | - ], |
|
447 | - [ |
|
448 | - 4226, |
|
449 | - 4226, |
|
450 | - ], |
|
451 | - [ |
|
452 | - 4229, |
|
453 | - 4230, |
|
454 | - ], |
|
455 | - [ |
|
456 | - 4237, |
|
457 | - 4237, |
|
458 | - ], |
|
459 | - [ |
|
460 | - 4253, |
|
461 | - 4253, |
|
462 | - ], |
|
463 | - [ |
|
464 | - 4957, |
|
465 | - 4959, |
|
466 | - ], |
|
467 | - [ |
|
468 | - 5906, |
|
469 | - 5908, |
|
470 | - ], |
|
471 | - [ |
|
472 | - 5938, |
|
473 | - 5940, |
|
474 | - ], |
|
475 | - [ |
|
476 | - 5970, |
|
477 | - 5971, |
|
478 | - ], |
|
479 | - [ |
|
480 | - 6002, |
|
481 | - 6003, |
|
482 | - ], |
|
483 | - [ |
|
484 | - 6068, |
|
485 | - 6069, |
|
486 | - ], |
|
487 | - [ |
|
488 | - 6071, |
|
489 | - 6077, |
|
490 | - ], |
|
491 | - [ |
|
492 | - 6086, |
|
493 | - 6086, |
|
494 | - ], |
|
495 | - [ |
|
496 | - 6089, |
|
497 | - 6099, |
|
498 | - ], |
|
499 | - [ |
|
500 | - 6109, |
|
501 | - 6109, |
|
502 | - ], |
|
503 | - [ |
|
504 | - 6155, |
|
505 | - 6157, |
|
506 | - ], |
|
507 | - [ |
|
508 | - 6277, |
|
509 | - 6278, |
|
510 | - ], |
|
511 | - [ |
|
512 | - 6313, |
|
513 | - 6313, |
|
514 | - ], |
|
515 | - [ |
|
516 | - 6432, |
|
517 | - 6434, |
|
518 | - ], |
|
519 | - [ |
|
520 | - 6439, |
|
521 | - 6440, |
|
522 | - ], |
|
523 | - [ |
|
524 | - 6450, |
|
525 | - 6450, |
|
526 | - ], |
|
527 | - [ |
|
528 | - 6457, |
|
529 | - 6459, |
|
530 | - ], |
|
531 | - [ |
|
532 | - 6679, |
|
533 | - 6680, |
|
534 | - ], |
|
535 | - [ |
|
536 | - 6683, |
|
537 | - 6683, |
|
538 | - ], |
|
539 | - [ |
|
540 | - 6742, |
|
541 | - 6742, |
|
542 | - ], |
|
543 | - [ |
|
544 | - 6744, |
|
545 | - 6750, |
|
546 | - ], |
|
547 | - [ |
|
548 | - 6752, |
|
549 | - 6752, |
|
550 | - ], |
|
551 | - [ |
|
552 | - 6754, |
|
553 | - 6754, |
|
554 | - ], |
|
555 | - [ |
|
556 | - 6757, |
|
557 | - 6764, |
|
558 | - ], |
|
559 | - [ |
|
560 | - 6771, |
|
561 | - 6780, |
|
562 | - ], |
|
563 | - [ |
|
564 | - 6783, |
|
565 | - 6783, |
|
566 | - ], |
|
567 | - [ |
|
568 | - 6832, |
|
569 | - 6845, |
|
570 | - ], |
|
571 | - [ |
|
572 | - 6846, |
|
573 | - 6846, |
|
574 | - ], |
|
575 | - [ |
|
576 | - 6847, |
|
577 | - 6848, |
|
578 | - ], |
|
579 | - [ |
|
580 | - 6912, |
|
581 | - 6915, |
|
582 | - ], |
|
583 | - [ |
|
584 | - 6964, |
|
585 | - 6964, |
|
586 | - ], |
|
587 | - [ |
|
588 | - 6966, |
|
589 | - 6970, |
|
590 | - ], |
|
591 | - [ |
|
592 | - 6972, |
|
593 | - 6972, |
|
594 | - ], |
|
595 | - [ |
|
596 | - 6978, |
|
597 | - 6978, |
|
598 | - ], |
|
599 | - [ |
|
600 | - 7019, |
|
601 | - 7027, |
|
602 | - ], |
|
603 | - [ |
|
604 | - 7040, |
|
605 | - 7041, |
|
606 | - ], |
|
607 | - [ |
|
608 | - 7074, |
|
609 | - 7077, |
|
610 | - ], |
|
611 | - [ |
|
612 | - 7080, |
|
613 | - 7081, |
|
614 | - ], |
|
615 | - [ |
|
616 | - 7083, |
|
617 | - 7085, |
|
618 | - ], |
|
619 | - [ |
|
620 | - 7142, |
|
621 | - 7142, |
|
622 | - ], |
|
623 | - [ |
|
624 | - 7144, |
|
625 | - 7145, |
|
626 | - ], |
|
627 | - [ |
|
628 | - 7149, |
|
629 | - 7149, |
|
630 | - ], |
|
631 | - [ |
|
632 | - 7151, |
|
633 | - 7153, |
|
634 | - ], |
|
635 | - [ |
|
636 | - 7212, |
|
637 | - 7219, |
|
638 | - ], |
|
639 | - [ |
|
640 | - 7222, |
|
641 | - 7223, |
|
642 | - ], |
|
643 | - [ |
|
644 | - 7376, |
|
645 | - 7378, |
|
646 | - ], |
|
647 | - [ |
|
648 | - 7380, |
|
649 | - 7392, |
|
650 | - ], |
|
651 | - [ |
|
652 | - 7394, |
|
653 | - 7400, |
|
654 | - ], |
|
655 | - [ |
|
656 | - 7405, |
|
657 | - 7405, |
|
658 | - ], |
|
659 | - [ |
|
660 | - 7412, |
|
661 | - 7412, |
|
662 | - ], |
|
663 | - [ |
|
664 | - 7416, |
|
665 | - 7417, |
|
666 | - ], |
|
667 | - [ |
|
668 | - 7616, |
|
669 | - 7673, |
|
670 | - ], |
|
671 | - [ |
|
672 | - 7675, |
|
673 | - 7679, |
|
674 | - ], |
|
675 | - [ |
|
676 | - 8400, |
|
677 | - 8412, |
|
678 | - ], |
|
679 | - [ |
|
680 | - 8413, |
|
681 | - 8416, |
|
682 | - ], |
|
683 | - [ |
|
684 | - 8417, |
|
685 | - 8417, |
|
686 | - ], |
|
687 | - [ |
|
688 | - 8418, |
|
689 | - 8420, |
|
690 | - ], |
|
691 | - [ |
|
692 | - 8421, |
|
693 | - 8432, |
|
694 | - ], |
|
695 | - [ |
|
696 | - 11503, |
|
697 | - 11505, |
|
698 | - ], |
|
699 | - [ |
|
700 | - 11647, |
|
701 | - 11647, |
|
702 | - ], |
|
703 | - [ |
|
704 | - 11744, |
|
705 | - 11775, |
|
706 | - ], |
|
707 | - [ |
|
708 | - 12330, |
|
709 | - 12333, |
|
710 | - ], |
|
711 | - [ |
|
712 | - 12441, |
|
713 | - 12442, |
|
714 | - ], |
|
715 | - [ |
|
716 | - 42607, |
|
717 | - 42607, |
|
718 | - ], |
|
719 | - [ |
|
720 | - 42608, |
|
721 | - 42610, |
|
722 | - ], |
|
723 | - [ |
|
724 | - 42612, |
|
725 | - 42621, |
|
726 | - ], |
|
727 | - [ |
|
728 | - 42654, |
|
729 | - 42655, |
|
730 | - ], |
|
731 | - [ |
|
732 | - 42736, |
|
733 | - 42737, |
|
734 | - ], |
|
735 | - [ |
|
736 | - 43010, |
|
737 | - 43010, |
|
738 | - ], |
|
739 | - [ |
|
740 | - 43014, |
|
741 | - 43014, |
|
742 | - ], |
|
743 | - [ |
|
744 | - 43019, |
|
745 | - 43019, |
|
746 | - ], |
|
747 | - [ |
|
748 | - 43045, |
|
749 | - 43046, |
|
750 | - ], |
|
751 | - [ |
|
752 | - 43052, |
|
753 | - 43052, |
|
754 | - ], |
|
755 | - [ |
|
756 | - 43204, |
|
757 | - 43205, |
|
758 | - ], |
|
759 | - [ |
|
760 | - 43232, |
|
761 | - 43249, |
|
762 | - ], |
|
763 | - [ |
|
764 | - 43263, |
|
765 | - 43263, |
|
766 | - ], |
|
767 | - [ |
|
768 | - 43302, |
|
769 | - 43309, |
|
770 | - ], |
|
771 | - [ |
|
772 | - 43335, |
|
773 | - 43345, |
|
774 | - ], |
|
775 | - [ |
|
776 | - 43392, |
|
777 | - 43394, |
|
778 | - ], |
|
779 | - [ |
|
780 | - 43443, |
|
781 | - 43443, |
|
782 | - ], |
|
783 | - [ |
|
784 | - 43446, |
|
785 | - 43449, |
|
786 | - ], |
|
787 | - [ |
|
788 | - 43452, |
|
789 | - 43453, |
|
790 | - ], |
|
791 | - [ |
|
792 | - 43493, |
|
793 | - 43493, |
|
794 | - ], |
|
795 | - [ |
|
796 | - 43561, |
|
797 | - 43566, |
|
798 | - ], |
|
799 | - [ |
|
800 | - 43569, |
|
801 | - 43570, |
|
802 | - ], |
|
803 | - [ |
|
804 | - 43573, |
|
805 | - 43574, |
|
806 | - ], |
|
807 | - [ |
|
808 | - 43587, |
|
809 | - 43587, |
|
810 | - ], |
|
811 | - [ |
|
812 | - 43596, |
|
813 | - 43596, |
|
814 | - ], |
|
815 | - [ |
|
816 | - 43644, |
|
817 | - 43644, |
|
818 | - ], |
|
819 | - [ |
|
820 | - 43696, |
|
821 | - 43696, |
|
822 | - ], |
|
823 | - [ |
|
824 | - 43698, |
|
825 | - 43700, |
|
826 | - ], |
|
827 | - [ |
|
828 | - 43703, |
|
829 | - 43704, |
|
830 | - ], |
|
831 | - [ |
|
832 | - 43710, |
|
833 | - 43711, |
|
834 | - ], |
|
835 | - [ |
|
836 | - 43713, |
|
837 | - 43713, |
|
838 | - ], |
|
839 | - [ |
|
840 | - 43756, |
|
841 | - 43757, |
|
842 | - ], |
|
843 | - [ |
|
844 | - 43766, |
|
845 | - 43766, |
|
846 | - ], |
|
847 | - [ |
|
848 | - 44005, |
|
849 | - 44005, |
|
850 | - ], |
|
851 | - [ |
|
852 | - 44008, |
|
853 | - 44008, |
|
854 | - ], |
|
855 | - [ |
|
856 | - 44013, |
|
857 | - 44013, |
|
858 | - ], |
|
859 | - [ |
|
860 | - 64286, |
|
861 | - 64286, |
|
862 | - ], |
|
863 | - [ |
|
864 | - 65024, |
|
865 | - 65039, |
|
866 | - ], |
|
867 | - [ |
|
868 | - 65056, |
|
869 | - 65071, |
|
870 | - ], |
|
871 | - [ |
|
872 | - 66045, |
|
873 | - 66045, |
|
874 | - ], |
|
875 | - [ |
|
876 | - 66272, |
|
877 | - 66272, |
|
878 | - ], |
|
879 | - [ |
|
880 | - 66422, |
|
881 | - 66426, |
|
882 | - ], |
|
883 | - [ |
|
884 | - 68097, |
|
885 | - 68099, |
|
886 | - ], |
|
887 | - [ |
|
888 | - 68101, |
|
889 | - 68102, |
|
890 | - ], |
|
891 | - [ |
|
892 | - 68108, |
|
893 | - 68111, |
|
894 | - ], |
|
895 | - [ |
|
896 | - 68152, |
|
897 | - 68154, |
|
898 | - ], |
|
899 | - [ |
|
900 | - 68159, |
|
901 | - 68159, |
|
902 | - ], |
|
903 | - [ |
|
904 | - 68325, |
|
905 | - 68326, |
|
906 | - ], |
|
907 | - [ |
|
908 | - 68900, |
|
909 | - 68903, |
|
910 | - ], |
|
911 | - [ |
|
912 | - 69291, |
|
913 | - 69292, |
|
914 | - ], |
|
915 | - [ |
|
916 | - 69446, |
|
917 | - 69456, |
|
918 | - ], |
|
919 | - [ |
|
920 | - 69633, |
|
921 | - 69633, |
|
922 | - ], |
|
923 | - [ |
|
924 | - 69688, |
|
925 | - 69702, |
|
926 | - ], |
|
927 | - [ |
|
928 | - 69759, |
|
929 | - 69761, |
|
930 | - ], |
|
931 | - [ |
|
932 | - 69811, |
|
933 | - 69814, |
|
934 | - ], |
|
935 | - [ |
|
936 | - 69817, |
|
937 | - 69818, |
|
938 | - ], |
|
939 | - [ |
|
940 | - 69888, |
|
941 | - 69890, |
|
942 | - ], |
|
943 | - [ |
|
944 | - 69927, |
|
945 | - 69931, |
|
946 | - ], |
|
947 | - [ |
|
948 | - 69933, |
|
949 | - 69940, |
|
950 | - ], |
|
951 | - [ |
|
952 | - 70003, |
|
953 | - 70003, |
|
954 | - ], |
|
955 | - [ |
|
956 | - 70016, |
|
957 | - 70017, |
|
958 | - ], |
|
959 | - [ |
|
960 | - 70070, |
|
961 | - 70078, |
|
962 | - ], |
|
963 | - [ |
|
964 | - 70089, |
|
965 | - 70092, |
|
966 | - ], |
|
967 | - [ |
|
968 | - 70095, |
|
969 | - 70095, |
|
970 | - ], |
|
971 | - [ |
|
972 | - 70191, |
|
973 | - 70193, |
|
974 | - ], |
|
975 | - [ |
|
976 | - 70196, |
|
977 | - 70196, |
|
978 | - ], |
|
979 | - [ |
|
980 | - 70198, |
|
981 | - 70199, |
|
982 | - ], |
|
983 | - [ |
|
984 | - 70206, |
|
985 | - 70206, |
|
986 | - ], |
|
987 | - [ |
|
988 | - 70367, |
|
989 | - 70367, |
|
990 | - ], |
|
991 | - [ |
|
992 | - 70371, |
|
993 | - 70378, |
|
994 | - ], |
|
995 | - [ |
|
996 | - 70400, |
|
997 | - 70401, |
|
998 | - ], |
|
999 | - [ |
|
1000 | - 70459, |
|
1001 | - 70460, |
|
1002 | - ], |
|
1003 | - [ |
|
1004 | - 70464, |
|
1005 | - 70464, |
|
1006 | - ], |
|
1007 | - [ |
|
1008 | - 70502, |
|
1009 | - 70508, |
|
1010 | - ], |
|
1011 | - [ |
|
1012 | - 70512, |
|
1013 | - 70516, |
|
1014 | - ], |
|
1015 | - [ |
|
1016 | - 70712, |
|
1017 | - 70719, |
|
1018 | - ], |
|
1019 | - [ |
|
1020 | - 70722, |
|
1021 | - 70724, |
|
1022 | - ], |
|
1023 | - [ |
|
1024 | - 70726, |
|
1025 | - 70726, |
|
1026 | - ], |
|
1027 | - [ |
|
1028 | - 70750, |
|
1029 | - 70750, |
|
1030 | - ], |
|
1031 | - [ |
|
1032 | - 70835, |
|
1033 | - 70840, |
|
1034 | - ], |
|
1035 | - [ |
|
1036 | - 70842, |
|
1037 | - 70842, |
|
1038 | - ], |
|
1039 | - [ |
|
1040 | - 70847, |
|
1041 | - 70848, |
|
1042 | - ], |
|
1043 | - [ |
|
1044 | - 70850, |
|
1045 | - 70851, |
|
1046 | - ], |
|
1047 | - [ |
|
1048 | - 71090, |
|
1049 | - 71093, |
|
1050 | - ], |
|
1051 | - [ |
|
1052 | - 71100, |
|
1053 | - 71101, |
|
1054 | - ], |
|
1055 | - [ |
|
1056 | - 71103, |
|
1057 | - 71104, |
|
1058 | - ], |
|
1059 | - [ |
|
1060 | - 71132, |
|
1061 | - 71133, |
|
1062 | - ], |
|
1063 | - [ |
|
1064 | - 71219, |
|
1065 | - 71226, |
|
1066 | - ], |
|
1067 | - [ |
|
1068 | - 71229, |
|
1069 | - 71229, |
|
1070 | - ], |
|
1071 | - [ |
|
1072 | - 71231, |
|
1073 | - 71232, |
|
1074 | - ], |
|
1075 | - [ |
|
1076 | - 71339, |
|
1077 | - 71339, |
|
1078 | - ], |
|
1079 | - [ |
|
1080 | - 71341, |
|
1081 | - 71341, |
|
1082 | - ], |
|
1083 | - [ |
|
1084 | - 71344, |
|
1085 | - 71349, |
|
1086 | - ], |
|
1087 | - [ |
|
1088 | - 71351, |
|
1089 | - 71351, |
|
1090 | - ], |
|
1091 | - [ |
|
1092 | - 71453, |
|
1093 | - 71455, |
|
1094 | - ], |
|
1095 | - [ |
|
1096 | - 71458, |
|
1097 | - 71461, |
|
1098 | - ], |
|
1099 | - [ |
|
1100 | - 71463, |
|
1101 | - 71467, |
|
1102 | - ], |
|
1103 | - [ |
|
1104 | - 71727, |
|
1105 | - 71735, |
|
1106 | - ], |
|
1107 | - [ |
|
1108 | - 71737, |
|
1109 | - 71738, |
|
1110 | - ], |
|
1111 | - [ |
|
1112 | - 71995, |
|
1113 | - 71996, |
|
1114 | - ], |
|
1115 | - [ |
|
1116 | - 71998, |
|
1117 | - 71998, |
|
1118 | - ], |
|
1119 | - [ |
|
1120 | - 72003, |
|
1121 | - 72003, |
|
1122 | - ], |
|
1123 | - [ |
|
1124 | - 72148, |
|
1125 | - 72151, |
|
1126 | - ], |
|
1127 | - [ |
|
1128 | - 72154, |
|
1129 | - 72155, |
|
1130 | - ], |
|
1131 | - [ |
|
1132 | - 72160, |
|
1133 | - 72160, |
|
1134 | - ], |
|
1135 | - [ |
|
1136 | - 72193, |
|
1137 | - 72202, |
|
1138 | - ], |
|
1139 | - [ |
|
1140 | - 72243, |
|
1141 | - 72248, |
|
1142 | - ], |
|
1143 | - [ |
|
1144 | - 72251, |
|
1145 | - 72254, |
|
1146 | - ], |
|
1147 | - [ |
|
1148 | - 72263, |
|
1149 | - 72263, |
|
1150 | - ], |
|
1151 | - [ |
|
1152 | - 72273, |
|
1153 | - 72278, |
|
1154 | - ], |
|
1155 | - [ |
|
1156 | - 72281, |
|
1157 | - 72283, |
|
1158 | - ], |
|
1159 | - [ |
|
1160 | - 72330, |
|
1161 | - 72342, |
|
1162 | - ], |
|
1163 | - [ |
|
1164 | - 72344, |
|
1165 | - 72345, |
|
1166 | - ], |
|
1167 | - [ |
|
1168 | - 72752, |
|
1169 | - 72758, |
|
1170 | - ], |
|
1171 | - [ |
|
1172 | - 72760, |
|
1173 | - 72765, |
|
1174 | - ], |
|
1175 | - [ |
|
1176 | - 72767, |
|
1177 | - 72767, |
|
1178 | - ], |
|
1179 | - [ |
|
1180 | - 72850, |
|
1181 | - 72871, |
|
1182 | - ], |
|
1183 | - [ |
|
1184 | - 72874, |
|
1185 | - 72880, |
|
1186 | - ], |
|
1187 | - [ |
|
1188 | - 72882, |
|
1189 | - 72883, |
|
1190 | - ], |
|
1191 | - [ |
|
1192 | - 72885, |
|
1193 | - 72886, |
|
1194 | - ], |
|
1195 | - [ |
|
1196 | - 73009, |
|
1197 | - 73014, |
|
1198 | - ], |
|
1199 | - [ |
|
1200 | - 73018, |
|
1201 | - 73018, |
|
1202 | - ], |
|
1203 | - [ |
|
1204 | - 73020, |
|
1205 | - 73021, |
|
1206 | - ], |
|
1207 | - [ |
|
1208 | - 73023, |
|
1209 | - 73029, |
|
1210 | - ], |
|
1211 | - [ |
|
1212 | - 73031, |
|
1213 | - 73031, |
|
1214 | - ], |
|
1215 | - [ |
|
1216 | - 73104, |
|
1217 | - 73105, |
|
1218 | - ], |
|
1219 | - [ |
|
1220 | - 73109, |
|
1221 | - 73109, |
|
1222 | - ], |
|
1223 | - [ |
|
1224 | - 73111, |
|
1225 | - 73111, |
|
1226 | - ], |
|
1227 | - [ |
|
1228 | - 73459, |
|
1229 | - 73460, |
|
1230 | - ], |
|
1231 | - [ |
|
1232 | - 92912, |
|
1233 | - 92916, |
|
1234 | - ], |
|
1235 | - [ |
|
1236 | - 92976, |
|
1237 | - 92982, |
|
1238 | - ], |
|
1239 | - [ |
|
1240 | - 94031, |
|
1241 | - 94031, |
|
1242 | - ], |
|
1243 | - [ |
|
1244 | - 94095, |
|
1245 | - 94098, |
|
1246 | - ], |
|
1247 | - [ |
|
1248 | - 94180, |
|
1249 | - 94180, |
|
1250 | - ], |
|
1251 | - [ |
|
1252 | - 113821, |
|
1253 | - 113822, |
|
1254 | - ], |
|
1255 | - [ |
|
1256 | - 119143, |
|
1257 | - 119145, |
|
1258 | - ], |
|
1259 | - [ |
|
1260 | - 119163, |
|
1261 | - 119170, |
|
1262 | - ], |
|
1263 | - [ |
|
1264 | - 119173, |
|
1265 | - 119179, |
|
1266 | - ], |
|
1267 | - [ |
|
1268 | - 119210, |
|
1269 | - 119213, |
|
1270 | - ], |
|
1271 | - [ |
|
1272 | - 119362, |
|
1273 | - 119364, |
|
1274 | - ], |
|
1275 | - [ |
|
1276 | - 121344, |
|
1277 | - 121398, |
|
1278 | - ], |
|
1279 | - [ |
|
1280 | - 121403, |
|
1281 | - 121452, |
|
1282 | - ], |
|
1283 | - [ |
|
1284 | - 121461, |
|
1285 | - 121461, |
|
1286 | - ], |
|
1287 | - [ |
|
1288 | - 121476, |
|
1289 | - 121476, |
|
1290 | - ], |
|
1291 | - [ |
|
1292 | - 121499, |
|
1293 | - 121503, |
|
1294 | - ], |
|
1295 | - [ |
|
1296 | - 121505, |
|
1297 | - 121519, |
|
1298 | - ], |
|
1299 | - [ |
|
1300 | - 122880, |
|
1301 | - 122886, |
|
1302 | - ], |
|
1303 | - [ |
|
1304 | - 122888, |
|
1305 | - 122904, |
|
1306 | - ], |
|
1307 | - [ |
|
1308 | - 122907, |
|
1309 | - 122913, |
|
1310 | - ], |
|
1311 | - [ |
|
1312 | - 122915, |
|
1313 | - 122916, |
|
1314 | - ], |
|
1315 | - [ |
|
1316 | - 122918, |
|
1317 | - 122922, |
|
1318 | - ], |
|
1319 | - [ |
|
1320 | - 123184, |
|
1321 | - 123190, |
|
1322 | - ], |
|
1323 | - [ |
|
1324 | - 123628, |
|
1325 | - 123631, |
|
1326 | - ], |
|
1327 | - [ |
|
1328 | - 125136, |
|
1329 | - 125142, |
|
1330 | - ], |
|
1331 | - [ |
|
1332 | - 125252, |
|
1333 | - 125258, |
|
1334 | - ], |
|
1335 | - [ |
|
1336 | - 917760, |
|
1337 | - 917999, |
|
1338 | - ], |
|
11 | + [ |
|
12 | + 768, |
|
13 | + 879, |
|
14 | + ], |
|
15 | + [ |
|
16 | + 1155, |
|
17 | + 1159, |
|
18 | + ], |
|
19 | + [ |
|
20 | + 1160, |
|
21 | + 1161, |
|
22 | + ], |
|
23 | + [ |
|
24 | + 1425, |
|
25 | + 1469, |
|
26 | + ], |
|
27 | + [ |
|
28 | + 1471, |
|
29 | + 1471, |
|
30 | + ], |
|
31 | + [ |
|
32 | + 1473, |
|
33 | + 1474, |
|
34 | + ], |
|
35 | + [ |
|
36 | + 1476, |
|
37 | + 1477, |
|
38 | + ], |
|
39 | + [ |
|
40 | + 1479, |
|
41 | + 1479, |
|
42 | + ], |
|
43 | + [ |
|
44 | + 1552, |
|
45 | + 1562, |
|
46 | + ], |
|
47 | + [ |
|
48 | + 1611, |
|
49 | + 1631, |
|
50 | + ], |
|
51 | + [ |
|
52 | + 1648, |
|
53 | + 1648, |
|
54 | + ], |
|
55 | + [ |
|
56 | + 1750, |
|
57 | + 1756, |
|
58 | + ], |
|
59 | + [ |
|
60 | + 1759, |
|
61 | + 1764, |
|
62 | + ], |
|
63 | + [ |
|
64 | + 1767, |
|
65 | + 1768, |
|
66 | + ], |
|
67 | + [ |
|
68 | + 1770, |
|
69 | + 1773, |
|
70 | + ], |
|
71 | + [ |
|
72 | + 1809, |
|
73 | + 1809, |
|
74 | + ], |
|
75 | + [ |
|
76 | + 1840, |
|
77 | + 1866, |
|
78 | + ], |
|
79 | + [ |
|
80 | + 1958, |
|
81 | + 1968, |
|
82 | + ], |
|
83 | + [ |
|
84 | + 2027, |
|
85 | + 2035, |
|
86 | + ], |
|
87 | + [ |
|
88 | + 2045, |
|
89 | + 2045, |
|
90 | + ], |
|
91 | + [ |
|
92 | + 2070, |
|
93 | + 2073, |
|
94 | + ], |
|
95 | + [ |
|
96 | + 2075, |
|
97 | + 2083, |
|
98 | + ], |
|
99 | + [ |
|
100 | + 2085, |
|
101 | + 2087, |
|
102 | + ], |
|
103 | + [ |
|
104 | + 2089, |
|
105 | + 2093, |
|
106 | + ], |
|
107 | + [ |
|
108 | + 2137, |
|
109 | + 2139, |
|
110 | + ], |
|
111 | + [ |
|
112 | + 2259, |
|
113 | + 2273, |
|
114 | + ], |
|
115 | + [ |
|
116 | + 2275, |
|
117 | + 2306, |
|
118 | + ], |
|
119 | + [ |
|
120 | + 2362, |
|
121 | + 2362, |
|
122 | + ], |
|
123 | + [ |
|
124 | + 2364, |
|
125 | + 2364, |
|
126 | + ], |
|
127 | + [ |
|
128 | + 2369, |
|
129 | + 2376, |
|
130 | + ], |
|
131 | + [ |
|
132 | + 2381, |
|
133 | + 2381, |
|
134 | + ], |
|
135 | + [ |
|
136 | + 2385, |
|
137 | + 2391, |
|
138 | + ], |
|
139 | + [ |
|
140 | + 2402, |
|
141 | + 2403, |
|
142 | + ], |
|
143 | + [ |
|
144 | + 2433, |
|
145 | + 2433, |
|
146 | + ], |
|
147 | + [ |
|
148 | + 2492, |
|
149 | + 2492, |
|
150 | + ], |
|
151 | + [ |
|
152 | + 2497, |
|
153 | + 2500, |
|
154 | + ], |
|
155 | + [ |
|
156 | + 2509, |
|
157 | + 2509, |
|
158 | + ], |
|
159 | + [ |
|
160 | + 2530, |
|
161 | + 2531, |
|
162 | + ], |
|
163 | + [ |
|
164 | + 2558, |
|
165 | + 2558, |
|
166 | + ], |
|
167 | + [ |
|
168 | + 2561, |
|
169 | + 2562, |
|
170 | + ], |
|
171 | + [ |
|
172 | + 2620, |
|
173 | + 2620, |
|
174 | + ], |
|
175 | + [ |
|
176 | + 2625, |
|
177 | + 2626, |
|
178 | + ], |
|
179 | + [ |
|
180 | + 2631, |
|
181 | + 2632, |
|
182 | + ], |
|
183 | + [ |
|
184 | + 2635, |
|
185 | + 2637, |
|
186 | + ], |
|
187 | + [ |
|
188 | + 2641, |
|
189 | + 2641, |
|
190 | + ], |
|
191 | + [ |
|
192 | + 2672, |
|
193 | + 2673, |
|
194 | + ], |
|
195 | + [ |
|
196 | + 2677, |
|
197 | + 2677, |
|
198 | + ], |
|
199 | + [ |
|
200 | + 2689, |
|
201 | + 2690, |
|
202 | + ], |
|
203 | + [ |
|
204 | + 2748, |
|
205 | + 2748, |
|
206 | + ], |
|
207 | + [ |
|
208 | + 2753, |
|
209 | + 2757, |
|
210 | + ], |
|
211 | + [ |
|
212 | + 2759, |
|
213 | + 2760, |
|
214 | + ], |
|
215 | + [ |
|
216 | + 2765, |
|
217 | + 2765, |
|
218 | + ], |
|
219 | + [ |
|
220 | + 2786, |
|
221 | + 2787, |
|
222 | + ], |
|
223 | + [ |
|
224 | + 2810, |
|
225 | + 2815, |
|
226 | + ], |
|
227 | + [ |
|
228 | + 2817, |
|
229 | + 2817, |
|
230 | + ], |
|
231 | + [ |
|
232 | + 2876, |
|
233 | + 2876, |
|
234 | + ], |
|
235 | + [ |
|
236 | + 2879, |
|
237 | + 2879, |
|
238 | + ], |
|
239 | + [ |
|
240 | + 2881, |
|
241 | + 2884, |
|
242 | + ], |
|
243 | + [ |
|
244 | + 2893, |
|
245 | + 2893, |
|
246 | + ], |
|
247 | + [ |
|
248 | + 2901, |
|
249 | + 2902, |
|
250 | + ], |
|
251 | + [ |
|
252 | + 2914, |
|
253 | + 2915, |
|
254 | + ], |
|
255 | + [ |
|
256 | + 2946, |
|
257 | + 2946, |
|
258 | + ], |
|
259 | + [ |
|
260 | + 3008, |
|
261 | + 3008, |
|
262 | + ], |
|
263 | + [ |
|
264 | + 3021, |
|
265 | + 3021, |
|
266 | + ], |
|
267 | + [ |
|
268 | + 3072, |
|
269 | + 3072, |
|
270 | + ], |
|
271 | + [ |
|
272 | + 3076, |
|
273 | + 3076, |
|
274 | + ], |
|
275 | + [ |
|
276 | + 3134, |
|
277 | + 3136, |
|
278 | + ], |
|
279 | + [ |
|
280 | + 3142, |
|
281 | + 3144, |
|
282 | + ], |
|
283 | + [ |
|
284 | + 3146, |
|
285 | + 3149, |
|
286 | + ], |
|
287 | + [ |
|
288 | + 3157, |
|
289 | + 3158, |
|
290 | + ], |
|
291 | + [ |
|
292 | + 3170, |
|
293 | + 3171, |
|
294 | + ], |
|
295 | + [ |
|
296 | + 3201, |
|
297 | + 3201, |
|
298 | + ], |
|
299 | + [ |
|
300 | + 3260, |
|
301 | + 3260, |
|
302 | + ], |
|
303 | + [ |
|
304 | + 3263, |
|
305 | + 3263, |
|
306 | + ], |
|
307 | + [ |
|
308 | + 3270, |
|
309 | + 3270, |
|
310 | + ], |
|
311 | + [ |
|
312 | + 3276, |
|
313 | + 3277, |
|
314 | + ], |
|
315 | + [ |
|
316 | + 3298, |
|
317 | + 3299, |
|
318 | + ], |
|
319 | + [ |
|
320 | + 3328, |
|
321 | + 3329, |
|
322 | + ], |
|
323 | + [ |
|
324 | + 3387, |
|
325 | + 3388, |
|
326 | + ], |
|
327 | + [ |
|
328 | + 3393, |
|
329 | + 3396, |
|
330 | + ], |
|
331 | + [ |
|
332 | + 3405, |
|
333 | + 3405, |
|
334 | + ], |
|
335 | + [ |
|
336 | + 3426, |
|
337 | + 3427, |
|
338 | + ], |
|
339 | + [ |
|
340 | + 3457, |
|
341 | + 3457, |
|
342 | + ], |
|
343 | + [ |
|
344 | + 3530, |
|
345 | + 3530, |
|
346 | + ], |
|
347 | + [ |
|
348 | + 3538, |
|
349 | + 3540, |
|
350 | + ], |
|
351 | + [ |
|
352 | + 3542, |
|
353 | + 3542, |
|
354 | + ], |
|
355 | + [ |
|
356 | + 3633, |
|
357 | + 3633, |
|
358 | + ], |
|
359 | + [ |
|
360 | + 3636, |
|
361 | + 3642, |
|
362 | + ], |
|
363 | + [ |
|
364 | + 3655, |
|
365 | + 3662, |
|
366 | + ], |
|
367 | + [ |
|
368 | + 3761, |
|
369 | + 3761, |
|
370 | + ], |
|
371 | + [ |
|
372 | + 3764, |
|
373 | + 3772, |
|
374 | + ], |
|
375 | + [ |
|
376 | + 3784, |
|
377 | + 3789, |
|
378 | + ], |
|
379 | + [ |
|
380 | + 3864, |
|
381 | + 3865, |
|
382 | + ], |
|
383 | + [ |
|
384 | + 3893, |
|
385 | + 3893, |
|
386 | + ], |
|
387 | + [ |
|
388 | + 3895, |
|
389 | + 3895, |
|
390 | + ], |
|
391 | + [ |
|
392 | + 3897, |
|
393 | + 3897, |
|
394 | + ], |
|
395 | + [ |
|
396 | + 3953, |
|
397 | + 3966, |
|
398 | + ], |
|
399 | + [ |
|
400 | + 3968, |
|
401 | + 3972, |
|
402 | + ], |
|
403 | + [ |
|
404 | + 3974, |
|
405 | + 3975, |
|
406 | + ], |
|
407 | + [ |
|
408 | + 3981, |
|
409 | + 3991, |
|
410 | + ], |
|
411 | + [ |
|
412 | + 3993, |
|
413 | + 4028, |
|
414 | + ], |
|
415 | + [ |
|
416 | + 4038, |
|
417 | + 4038, |
|
418 | + ], |
|
419 | + [ |
|
420 | + 4141, |
|
421 | + 4144, |
|
422 | + ], |
|
423 | + [ |
|
424 | + 4146, |
|
425 | + 4151, |
|
426 | + ], |
|
427 | + [ |
|
428 | + 4153, |
|
429 | + 4154, |
|
430 | + ], |
|
431 | + [ |
|
432 | + 4157, |
|
433 | + 4158, |
|
434 | + ], |
|
435 | + [ |
|
436 | + 4184, |
|
437 | + 4185, |
|
438 | + ], |
|
439 | + [ |
|
440 | + 4190, |
|
441 | + 4192, |
|
442 | + ], |
|
443 | + [ |
|
444 | + 4209, |
|
445 | + 4212, |
|
446 | + ], |
|
447 | + [ |
|
448 | + 4226, |
|
449 | + 4226, |
|
450 | + ], |
|
451 | + [ |
|
452 | + 4229, |
|
453 | + 4230, |
|
454 | + ], |
|
455 | + [ |
|
456 | + 4237, |
|
457 | + 4237, |
|
458 | + ], |
|
459 | + [ |
|
460 | + 4253, |
|
461 | + 4253, |
|
462 | + ], |
|
463 | + [ |
|
464 | + 4957, |
|
465 | + 4959, |
|
466 | + ], |
|
467 | + [ |
|
468 | + 5906, |
|
469 | + 5908, |
|
470 | + ], |
|
471 | + [ |
|
472 | + 5938, |
|
473 | + 5940, |
|
474 | + ], |
|
475 | + [ |
|
476 | + 5970, |
|
477 | + 5971, |
|
478 | + ], |
|
479 | + [ |
|
480 | + 6002, |
|
481 | + 6003, |
|
482 | + ], |
|
483 | + [ |
|
484 | + 6068, |
|
485 | + 6069, |
|
486 | + ], |
|
487 | + [ |
|
488 | + 6071, |
|
489 | + 6077, |
|
490 | + ], |
|
491 | + [ |
|
492 | + 6086, |
|
493 | + 6086, |
|
494 | + ], |
|
495 | + [ |
|
496 | + 6089, |
|
497 | + 6099, |
|
498 | + ], |
|
499 | + [ |
|
500 | + 6109, |
|
501 | + 6109, |
|
502 | + ], |
|
503 | + [ |
|
504 | + 6155, |
|
505 | + 6157, |
|
506 | + ], |
|
507 | + [ |
|
508 | + 6277, |
|
509 | + 6278, |
|
510 | + ], |
|
511 | + [ |
|
512 | + 6313, |
|
513 | + 6313, |
|
514 | + ], |
|
515 | + [ |
|
516 | + 6432, |
|
517 | + 6434, |
|
518 | + ], |
|
519 | + [ |
|
520 | + 6439, |
|
521 | + 6440, |
|
522 | + ], |
|
523 | + [ |
|
524 | + 6450, |
|
525 | + 6450, |
|
526 | + ], |
|
527 | + [ |
|
528 | + 6457, |
|
529 | + 6459, |
|
530 | + ], |
|
531 | + [ |
|
532 | + 6679, |
|
533 | + 6680, |
|
534 | + ], |
|
535 | + [ |
|
536 | + 6683, |
|
537 | + 6683, |
|
538 | + ], |
|
539 | + [ |
|
540 | + 6742, |
|
541 | + 6742, |
|
542 | + ], |
|
543 | + [ |
|
544 | + 6744, |
|
545 | + 6750, |
|
546 | + ], |
|
547 | + [ |
|
548 | + 6752, |
|
549 | + 6752, |
|
550 | + ], |
|
551 | + [ |
|
552 | + 6754, |
|
553 | + 6754, |
|
554 | + ], |
|
555 | + [ |
|
556 | + 6757, |
|
557 | + 6764, |
|
558 | + ], |
|
559 | + [ |
|
560 | + 6771, |
|
561 | + 6780, |
|
562 | + ], |
|
563 | + [ |
|
564 | + 6783, |
|
565 | + 6783, |
|
566 | + ], |
|
567 | + [ |
|
568 | + 6832, |
|
569 | + 6845, |
|
570 | + ], |
|
571 | + [ |
|
572 | + 6846, |
|
573 | + 6846, |
|
574 | + ], |
|
575 | + [ |
|
576 | + 6847, |
|
577 | + 6848, |
|
578 | + ], |
|
579 | + [ |
|
580 | + 6912, |
|
581 | + 6915, |
|
582 | + ], |
|
583 | + [ |
|
584 | + 6964, |
|
585 | + 6964, |
|
586 | + ], |
|
587 | + [ |
|
588 | + 6966, |
|
589 | + 6970, |
|
590 | + ], |
|
591 | + [ |
|
592 | + 6972, |
|
593 | + 6972, |
|
594 | + ], |
|
595 | + [ |
|
596 | + 6978, |
|
597 | + 6978, |
|
598 | + ], |
|
599 | + [ |
|
600 | + 7019, |
|
601 | + 7027, |
|
602 | + ], |
|
603 | + [ |
|
604 | + 7040, |
|
605 | + 7041, |
|
606 | + ], |
|
607 | + [ |
|
608 | + 7074, |
|
609 | + 7077, |
|
610 | + ], |
|
611 | + [ |
|
612 | + 7080, |
|
613 | + 7081, |
|
614 | + ], |
|
615 | + [ |
|
616 | + 7083, |
|
617 | + 7085, |
|
618 | + ], |
|
619 | + [ |
|
620 | + 7142, |
|
621 | + 7142, |
|
622 | + ], |
|
623 | + [ |
|
624 | + 7144, |
|
625 | + 7145, |
|
626 | + ], |
|
627 | + [ |
|
628 | + 7149, |
|
629 | + 7149, |
|
630 | + ], |
|
631 | + [ |
|
632 | + 7151, |
|
633 | + 7153, |
|
634 | + ], |
|
635 | + [ |
|
636 | + 7212, |
|
637 | + 7219, |
|
638 | + ], |
|
639 | + [ |
|
640 | + 7222, |
|
641 | + 7223, |
|
642 | + ], |
|
643 | + [ |
|
644 | + 7376, |
|
645 | + 7378, |
|
646 | + ], |
|
647 | + [ |
|
648 | + 7380, |
|
649 | + 7392, |
|
650 | + ], |
|
651 | + [ |
|
652 | + 7394, |
|
653 | + 7400, |
|
654 | + ], |
|
655 | + [ |
|
656 | + 7405, |
|
657 | + 7405, |
|
658 | + ], |
|
659 | + [ |
|
660 | + 7412, |
|
661 | + 7412, |
|
662 | + ], |
|
663 | + [ |
|
664 | + 7416, |
|
665 | + 7417, |
|
666 | + ], |
|
667 | + [ |
|
668 | + 7616, |
|
669 | + 7673, |
|
670 | + ], |
|
671 | + [ |
|
672 | + 7675, |
|
673 | + 7679, |
|
674 | + ], |
|
675 | + [ |
|
676 | + 8400, |
|
677 | + 8412, |
|
678 | + ], |
|
679 | + [ |
|
680 | + 8413, |
|
681 | + 8416, |
|
682 | + ], |
|
683 | + [ |
|
684 | + 8417, |
|
685 | + 8417, |
|
686 | + ], |
|
687 | + [ |
|
688 | + 8418, |
|
689 | + 8420, |
|
690 | + ], |
|
691 | + [ |
|
692 | + 8421, |
|
693 | + 8432, |
|
694 | + ], |
|
695 | + [ |
|
696 | + 11503, |
|
697 | + 11505, |
|
698 | + ], |
|
699 | + [ |
|
700 | + 11647, |
|
701 | + 11647, |
|
702 | + ], |
|
703 | + [ |
|
704 | + 11744, |
|
705 | + 11775, |
|
706 | + ], |
|
707 | + [ |
|
708 | + 12330, |
|
709 | + 12333, |
|
710 | + ], |
|
711 | + [ |
|
712 | + 12441, |
|
713 | + 12442, |
|
714 | + ], |
|
715 | + [ |
|
716 | + 42607, |
|
717 | + 42607, |
|
718 | + ], |
|
719 | + [ |
|
720 | + 42608, |
|
721 | + 42610, |
|
722 | + ], |
|
723 | + [ |
|
724 | + 42612, |
|
725 | + 42621, |
|
726 | + ], |
|
727 | + [ |
|
728 | + 42654, |
|
729 | + 42655, |
|
730 | + ], |
|
731 | + [ |
|
732 | + 42736, |
|
733 | + 42737, |
|
734 | + ], |
|
735 | + [ |
|
736 | + 43010, |
|
737 | + 43010, |
|
738 | + ], |
|
739 | + [ |
|
740 | + 43014, |
|
741 | + 43014, |
|
742 | + ], |
|
743 | + [ |
|
744 | + 43019, |
|
745 | + 43019, |
|
746 | + ], |
|
747 | + [ |
|
748 | + 43045, |
|
749 | + 43046, |
|
750 | + ], |
|
751 | + [ |
|
752 | + 43052, |
|
753 | + 43052, |
|
754 | + ], |
|
755 | + [ |
|
756 | + 43204, |
|
757 | + 43205, |
|
758 | + ], |
|
759 | + [ |
|
760 | + 43232, |
|
761 | + 43249, |
|
762 | + ], |
|
763 | + [ |
|
764 | + 43263, |
|
765 | + 43263, |
|
766 | + ], |
|
767 | + [ |
|
768 | + 43302, |
|
769 | + 43309, |
|
770 | + ], |
|
771 | + [ |
|
772 | + 43335, |
|
773 | + 43345, |
|
774 | + ], |
|
775 | + [ |
|
776 | + 43392, |
|
777 | + 43394, |
|
778 | + ], |
|
779 | + [ |
|
780 | + 43443, |
|
781 | + 43443, |
|
782 | + ], |
|
783 | + [ |
|
784 | + 43446, |
|
785 | + 43449, |
|
786 | + ], |
|
787 | + [ |
|
788 | + 43452, |
|
789 | + 43453, |
|
790 | + ], |
|
791 | + [ |
|
792 | + 43493, |
|
793 | + 43493, |
|
794 | + ], |
|
795 | + [ |
|
796 | + 43561, |
|
797 | + 43566, |
|
798 | + ], |
|
799 | + [ |
|
800 | + 43569, |
|
801 | + 43570, |
|
802 | + ], |
|
803 | + [ |
|
804 | + 43573, |
|
805 | + 43574, |
|
806 | + ], |
|
807 | + [ |
|
808 | + 43587, |
|
809 | + 43587, |
|
810 | + ], |
|
811 | + [ |
|
812 | + 43596, |
|
813 | + 43596, |
|
814 | + ], |
|
815 | + [ |
|
816 | + 43644, |
|
817 | + 43644, |
|
818 | + ], |
|
819 | + [ |
|
820 | + 43696, |
|
821 | + 43696, |
|
822 | + ], |
|
823 | + [ |
|
824 | + 43698, |
|
825 | + 43700, |
|
826 | + ], |
|
827 | + [ |
|
828 | + 43703, |
|
829 | + 43704, |
|
830 | + ], |
|
831 | + [ |
|
832 | + 43710, |
|
833 | + 43711, |
|
834 | + ], |
|
835 | + [ |
|
836 | + 43713, |
|
837 | + 43713, |
|
838 | + ], |
|
839 | + [ |
|
840 | + 43756, |
|
841 | + 43757, |
|
842 | + ], |
|
843 | + [ |
|
844 | + 43766, |
|
845 | + 43766, |
|
846 | + ], |
|
847 | + [ |
|
848 | + 44005, |
|
849 | + 44005, |
|
850 | + ], |
|
851 | + [ |
|
852 | + 44008, |
|
853 | + 44008, |
|
854 | + ], |
|
855 | + [ |
|
856 | + 44013, |
|
857 | + 44013, |
|
858 | + ], |
|
859 | + [ |
|
860 | + 64286, |
|
861 | + 64286, |
|
862 | + ], |
|
863 | + [ |
|
864 | + 65024, |
|
865 | + 65039, |
|
866 | + ], |
|
867 | + [ |
|
868 | + 65056, |
|
869 | + 65071, |
|
870 | + ], |
|
871 | + [ |
|
872 | + 66045, |
|
873 | + 66045, |
|
874 | + ], |
|
875 | + [ |
|
876 | + 66272, |
|
877 | + 66272, |
|
878 | + ], |
|
879 | + [ |
|
880 | + 66422, |
|
881 | + 66426, |
|
882 | + ], |
|
883 | + [ |
|
884 | + 68097, |
|
885 | + 68099, |
|
886 | + ], |
|
887 | + [ |
|
888 | + 68101, |
|
889 | + 68102, |
|
890 | + ], |
|
891 | + [ |
|
892 | + 68108, |
|
893 | + 68111, |
|
894 | + ], |
|
895 | + [ |
|
896 | + 68152, |
|
897 | + 68154, |
|
898 | + ], |
|
899 | + [ |
|
900 | + 68159, |
|
901 | + 68159, |
|
902 | + ], |
|
903 | + [ |
|
904 | + 68325, |
|
905 | + 68326, |
|
906 | + ], |
|
907 | + [ |
|
908 | + 68900, |
|
909 | + 68903, |
|
910 | + ], |
|
911 | + [ |
|
912 | + 69291, |
|
913 | + 69292, |
|
914 | + ], |
|
915 | + [ |
|
916 | + 69446, |
|
917 | + 69456, |
|
918 | + ], |
|
919 | + [ |
|
920 | + 69633, |
|
921 | + 69633, |
|
922 | + ], |
|
923 | + [ |
|
924 | + 69688, |
|
925 | + 69702, |
|
926 | + ], |
|
927 | + [ |
|
928 | + 69759, |
|
929 | + 69761, |
|
930 | + ], |
|
931 | + [ |
|
932 | + 69811, |
|
933 | + 69814, |
|
934 | + ], |
|
935 | + [ |
|
936 | + 69817, |
|
937 | + 69818, |
|
938 | + ], |
|
939 | + [ |
|
940 | + 69888, |
|
941 | + 69890, |
|
942 | + ], |
|
943 | + [ |
|
944 | + 69927, |
|
945 | + 69931, |
|
946 | + ], |
|
947 | + [ |
|
948 | + 69933, |
|
949 | + 69940, |
|
950 | + ], |
|
951 | + [ |
|
952 | + 70003, |
|
953 | + 70003, |
|
954 | + ], |
|
955 | + [ |
|
956 | + 70016, |
|
957 | + 70017, |
|
958 | + ], |
|
959 | + [ |
|
960 | + 70070, |
|
961 | + 70078, |
|
962 | + ], |
|
963 | + [ |
|
964 | + 70089, |
|
965 | + 70092, |
|
966 | + ], |
|
967 | + [ |
|
968 | + 70095, |
|
969 | + 70095, |
|
970 | + ], |
|
971 | + [ |
|
972 | + 70191, |
|
973 | + 70193, |
|
974 | + ], |
|
975 | + [ |
|
976 | + 70196, |
|
977 | + 70196, |
|
978 | + ], |
|
979 | + [ |
|
980 | + 70198, |
|
981 | + 70199, |
|
982 | + ], |
|
983 | + [ |
|
984 | + 70206, |
|
985 | + 70206, |
|
986 | + ], |
|
987 | + [ |
|
988 | + 70367, |
|
989 | + 70367, |
|
990 | + ], |
|
991 | + [ |
|
992 | + 70371, |
|
993 | + 70378, |
|
994 | + ], |
|
995 | + [ |
|
996 | + 70400, |
|
997 | + 70401, |
|
998 | + ], |
|
999 | + [ |
|
1000 | + 70459, |
|
1001 | + 70460, |
|
1002 | + ], |
|
1003 | + [ |
|
1004 | + 70464, |
|
1005 | + 70464, |
|
1006 | + ], |
|
1007 | + [ |
|
1008 | + 70502, |
|
1009 | + 70508, |
|
1010 | + ], |
|
1011 | + [ |
|
1012 | + 70512, |
|
1013 | + 70516, |
|
1014 | + ], |
|
1015 | + [ |
|
1016 | + 70712, |
|
1017 | + 70719, |
|
1018 | + ], |
|
1019 | + [ |
|
1020 | + 70722, |
|
1021 | + 70724, |
|
1022 | + ], |
|
1023 | + [ |
|
1024 | + 70726, |
|
1025 | + 70726, |
|
1026 | + ], |
|
1027 | + [ |
|
1028 | + 70750, |
|
1029 | + 70750, |
|
1030 | + ], |
|
1031 | + [ |
|
1032 | + 70835, |
|
1033 | + 70840, |
|
1034 | + ], |
|
1035 | + [ |
|
1036 | + 70842, |
|
1037 | + 70842, |
|
1038 | + ], |
|
1039 | + [ |
|
1040 | + 70847, |
|
1041 | + 70848, |
|
1042 | + ], |
|
1043 | + [ |
|
1044 | + 70850, |
|
1045 | + 70851, |
|
1046 | + ], |
|
1047 | + [ |
|
1048 | + 71090, |
|
1049 | + 71093, |
|
1050 | + ], |
|
1051 | + [ |
|
1052 | + 71100, |
|
1053 | + 71101, |
|
1054 | + ], |
|
1055 | + [ |
|
1056 | + 71103, |
|
1057 | + 71104, |
|
1058 | + ], |
|
1059 | + [ |
|
1060 | + 71132, |
|
1061 | + 71133, |
|
1062 | + ], |
|
1063 | + [ |
|
1064 | + 71219, |
|
1065 | + 71226, |
|
1066 | + ], |
|
1067 | + [ |
|
1068 | + 71229, |
|
1069 | + 71229, |
|
1070 | + ], |
|
1071 | + [ |
|
1072 | + 71231, |
|
1073 | + 71232, |
|
1074 | + ], |
|
1075 | + [ |
|
1076 | + 71339, |
|
1077 | + 71339, |
|
1078 | + ], |
|
1079 | + [ |
|
1080 | + 71341, |
|
1081 | + 71341, |
|
1082 | + ], |
|
1083 | + [ |
|
1084 | + 71344, |
|
1085 | + 71349, |
|
1086 | + ], |
|
1087 | + [ |
|
1088 | + 71351, |
|
1089 | + 71351, |
|
1090 | + ], |
|
1091 | + [ |
|
1092 | + 71453, |
|
1093 | + 71455, |
|
1094 | + ], |
|
1095 | + [ |
|
1096 | + 71458, |
|
1097 | + 71461, |
|
1098 | + ], |
|
1099 | + [ |
|
1100 | + 71463, |
|
1101 | + 71467, |
|
1102 | + ], |
|
1103 | + [ |
|
1104 | + 71727, |
|
1105 | + 71735, |
|
1106 | + ], |
|
1107 | + [ |
|
1108 | + 71737, |
|
1109 | + 71738, |
|
1110 | + ], |
|
1111 | + [ |
|
1112 | + 71995, |
|
1113 | + 71996, |
|
1114 | + ], |
|
1115 | + [ |
|
1116 | + 71998, |
|
1117 | + 71998, |
|
1118 | + ], |
|
1119 | + [ |
|
1120 | + 72003, |
|
1121 | + 72003, |
|
1122 | + ], |
|
1123 | + [ |
|
1124 | + 72148, |
|
1125 | + 72151, |
|
1126 | + ], |
|
1127 | + [ |
|
1128 | + 72154, |
|
1129 | + 72155, |
|
1130 | + ], |
|
1131 | + [ |
|
1132 | + 72160, |
|
1133 | + 72160, |
|
1134 | + ], |
|
1135 | + [ |
|
1136 | + 72193, |
|
1137 | + 72202, |
|
1138 | + ], |
|
1139 | + [ |
|
1140 | + 72243, |
|
1141 | + 72248, |
|
1142 | + ], |
|
1143 | + [ |
|
1144 | + 72251, |
|
1145 | + 72254, |
|
1146 | + ], |
|
1147 | + [ |
|
1148 | + 72263, |
|
1149 | + 72263, |
|
1150 | + ], |
|
1151 | + [ |
|
1152 | + 72273, |
|
1153 | + 72278, |
|
1154 | + ], |
|
1155 | + [ |
|
1156 | + 72281, |
|
1157 | + 72283, |
|
1158 | + ], |
|
1159 | + [ |
|
1160 | + 72330, |
|
1161 | + 72342, |
|
1162 | + ], |
|
1163 | + [ |
|
1164 | + 72344, |
|
1165 | + 72345, |
|
1166 | + ], |
|
1167 | + [ |
|
1168 | + 72752, |
|
1169 | + 72758, |
|
1170 | + ], |
|
1171 | + [ |
|
1172 | + 72760, |
|
1173 | + 72765, |
|
1174 | + ], |
|
1175 | + [ |
|
1176 | + 72767, |
|
1177 | + 72767, |
|
1178 | + ], |
|
1179 | + [ |
|
1180 | + 72850, |
|
1181 | + 72871, |
|
1182 | + ], |
|
1183 | + [ |
|
1184 | + 72874, |
|
1185 | + 72880, |
|
1186 | + ], |
|
1187 | + [ |
|
1188 | + 72882, |
|
1189 | + 72883, |
|
1190 | + ], |
|
1191 | + [ |
|
1192 | + 72885, |
|
1193 | + 72886, |
|
1194 | + ], |
|
1195 | + [ |
|
1196 | + 73009, |
|
1197 | + 73014, |
|
1198 | + ], |
|
1199 | + [ |
|
1200 | + 73018, |
|
1201 | + 73018, |
|
1202 | + ], |
|
1203 | + [ |
|
1204 | + 73020, |
|
1205 | + 73021, |
|
1206 | + ], |
|
1207 | + [ |
|
1208 | + 73023, |
|
1209 | + 73029, |
|
1210 | + ], |
|
1211 | + [ |
|
1212 | + 73031, |
|
1213 | + 73031, |
|
1214 | + ], |
|
1215 | + [ |
|
1216 | + 73104, |
|
1217 | + 73105, |
|
1218 | + ], |
|
1219 | + [ |
|
1220 | + 73109, |
|
1221 | + 73109, |
|
1222 | + ], |
|
1223 | + [ |
|
1224 | + 73111, |
|
1225 | + 73111, |
|
1226 | + ], |
|
1227 | + [ |
|
1228 | + 73459, |
|
1229 | + 73460, |
|
1230 | + ], |
|
1231 | + [ |
|
1232 | + 92912, |
|
1233 | + 92916, |
|
1234 | + ], |
|
1235 | + [ |
|
1236 | + 92976, |
|
1237 | + 92982, |
|
1238 | + ], |
|
1239 | + [ |
|
1240 | + 94031, |
|
1241 | + 94031, |
|
1242 | + ], |
|
1243 | + [ |
|
1244 | + 94095, |
|
1245 | + 94098, |
|
1246 | + ], |
|
1247 | + [ |
|
1248 | + 94180, |
|
1249 | + 94180, |
|
1250 | + ], |
|
1251 | + [ |
|
1252 | + 113821, |
|
1253 | + 113822, |
|
1254 | + ], |
|
1255 | + [ |
|
1256 | + 119143, |
|
1257 | + 119145, |
|
1258 | + ], |
|
1259 | + [ |
|
1260 | + 119163, |
|
1261 | + 119170, |
|
1262 | + ], |
|
1263 | + [ |
|
1264 | + 119173, |
|
1265 | + 119179, |
|
1266 | + ], |
|
1267 | + [ |
|
1268 | + 119210, |
|
1269 | + 119213, |
|
1270 | + ], |
|
1271 | + [ |
|
1272 | + 119362, |
|
1273 | + 119364, |
|
1274 | + ], |
|
1275 | + [ |
|
1276 | + 121344, |
|
1277 | + 121398, |
|
1278 | + ], |
|
1279 | + [ |
|
1280 | + 121403, |
|
1281 | + 121452, |
|
1282 | + ], |
|
1283 | + [ |
|
1284 | + 121461, |
|
1285 | + 121461, |
|
1286 | + ], |
|
1287 | + [ |
|
1288 | + 121476, |
|
1289 | + 121476, |
|
1290 | + ], |
|
1291 | + [ |
|
1292 | + 121499, |
|
1293 | + 121503, |
|
1294 | + ], |
|
1295 | + [ |
|
1296 | + 121505, |
|
1297 | + 121519, |
|
1298 | + ], |
|
1299 | + [ |
|
1300 | + 122880, |
|
1301 | + 122886, |
|
1302 | + ], |
|
1303 | + [ |
|
1304 | + 122888, |
|
1305 | + 122904, |
|
1306 | + ], |
|
1307 | + [ |
|
1308 | + 122907, |
|
1309 | + 122913, |
|
1310 | + ], |
|
1311 | + [ |
|
1312 | + 122915, |
|
1313 | + 122916, |
|
1314 | + ], |
|
1315 | + [ |
|
1316 | + 122918, |
|
1317 | + 122922, |
|
1318 | + ], |
|
1319 | + [ |
|
1320 | + 123184, |
|
1321 | + 123190, |
|
1322 | + ], |
|
1323 | + [ |
|
1324 | + 123628, |
|
1325 | + 123631, |
|
1326 | + ], |
|
1327 | + [ |
|
1328 | + 125136, |
|
1329 | + 125142, |
|
1330 | + ], |
|
1331 | + [ |
|
1332 | + 125252, |
|
1333 | + 125258, |
|
1334 | + ], |
|
1335 | + [ |
|
1336 | + 917760, |
|
1337 | + 917999, |
|
1338 | + ], |
|
1339 | 1339 | ]; |
@@ -8,1112 +8,1112 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | return [ |
11 | - [ |
|
12 | - 4352, |
|
13 | - 4447, |
|
14 | - ], |
|
15 | - [ |
|
16 | - 8986, |
|
17 | - 8987, |
|
18 | - ], |
|
19 | - [ |
|
20 | - 9001, |
|
21 | - 9001, |
|
22 | - ], |
|
23 | - [ |
|
24 | - 9002, |
|
25 | - 9002, |
|
26 | - ], |
|
27 | - [ |
|
28 | - 9193, |
|
29 | - 9196, |
|
30 | - ], |
|
31 | - [ |
|
32 | - 9200, |
|
33 | - 9200, |
|
34 | - ], |
|
35 | - [ |
|
36 | - 9203, |
|
37 | - 9203, |
|
38 | - ], |
|
39 | - [ |
|
40 | - 9725, |
|
41 | - 9726, |
|
42 | - ], |
|
43 | - [ |
|
44 | - 9748, |
|
45 | - 9749, |
|
46 | - ], |
|
47 | - [ |
|
48 | - 9800, |
|
49 | - 9811, |
|
50 | - ], |
|
51 | - [ |
|
52 | - 9855, |
|
53 | - 9855, |
|
54 | - ], |
|
55 | - [ |
|
56 | - 9875, |
|
57 | - 9875, |
|
58 | - ], |
|
59 | - [ |
|
60 | - 9889, |
|
61 | - 9889, |
|
62 | - ], |
|
63 | - [ |
|
64 | - 9898, |
|
65 | - 9899, |
|
66 | - ], |
|
67 | - [ |
|
68 | - 9917, |
|
69 | - 9918, |
|
70 | - ], |
|
71 | - [ |
|
72 | - 9924, |
|
73 | - 9925, |
|
74 | - ], |
|
75 | - [ |
|
76 | - 9934, |
|
77 | - 9934, |
|
78 | - ], |
|
79 | - [ |
|
80 | - 9940, |
|
81 | - 9940, |
|
82 | - ], |
|
83 | - [ |
|
84 | - 9962, |
|
85 | - 9962, |
|
86 | - ], |
|
87 | - [ |
|
88 | - 9970, |
|
89 | - 9971, |
|
90 | - ], |
|
91 | - [ |
|
92 | - 9973, |
|
93 | - 9973, |
|
94 | - ], |
|
95 | - [ |
|
96 | - 9978, |
|
97 | - 9978, |
|
98 | - ], |
|
99 | - [ |
|
100 | - 9981, |
|
101 | - 9981, |
|
102 | - ], |
|
103 | - [ |
|
104 | - 9989, |
|
105 | - 9989, |
|
106 | - ], |
|
107 | - [ |
|
108 | - 9994, |
|
109 | - 9995, |
|
110 | - ], |
|
111 | - [ |
|
112 | - 10024, |
|
113 | - 10024, |
|
114 | - ], |
|
115 | - [ |
|
116 | - 10060, |
|
117 | - 10060, |
|
118 | - ], |
|
119 | - [ |
|
120 | - 10062, |
|
121 | - 10062, |
|
122 | - ], |
|
123 | - [ |
|
124 | - 10067, |
|
125 | - 10069, |
|
126 | - ], |
|
127 | - [ |
|
128 | - 10071, |
|
129 | - 10071, |
|
130 | - ], |
|
131 | - [ |
|
132 | - 10133, |
|
133 | - 10135, |
|
134 | - ], |
|
135 | - [ |
|
136 | - 10160, |
|
137 | - 10160, |
|
138 | - ], |
|
139 | - [ |
|
140 | - 10175, |
|
141 | - 10175, |
|
142 | - ], |
|
143 | - [ |
|
144 | - 11035, |
|
145 | - 11036, |
|
146 | - ], |
|
147 | - [ |
|
148 | - 11088, |
|
149 | - 11088, |
|
150 | - ], |
|
151 | - [ |
|
152 | - 11093, |
|
153 | - 11093, |
|
154 | - ], |
|
155 | - [ |
|
156 | - 11904, |
|
157 | - 11929, |
|
158 | - ], |
|
159 | - [ |
|
160 | - 11931, |
|
161 | - 12019, |
|
162 | - ], |
|
163 | - [ |
|
164 | - 12032, |
|
165 | - 12245, |
|
166 | - ], |
|
167 | - [ |
|
168 | - 12272, |
|
169 | - 12283, |
|
170 | - ], |
|
171 | - [ |
|
172 | - 12288, |
|
173 | - 12288, |
|
174 | - ], |
|
175 | - [ |
|
176 | - 12289, |
|
177 | - 12291, |
|
178 | - ], |
|
179 | - [ |
|
180 | - 12292, |
|
181 | - 12292, |
|
182 | - ], |
|
183 | - [ |
|
184 | - 12293, |
|
185 | - 12293, |
|
186 | - ], |
|
187 | - [ |
|
188 | - 12294, |
|
189 | - 12294, |
|
190 | - ], |
|
191 | - [ |
|
192 | - 12295, |
|
193 | - 12295, |
|
194 | - ], |
|
195 | - [ |
|
196 | - 12296, |
|
197 | - 12296, |
|
198 | - ], |
|
199 | - [ |
|
200 | - 12297, |
|
201 | - 12297, |
|
202 | - ], |
|
203 | - [ |
|
204 | - 12298, |
|
205 | - 12298, |
|
206 | - ], |
|
207 | - [ |
|
208 | - 12299, |
|
209 | - 12299, |
|
210 | - ], |
|
211 | - [ |
|
212 | - 12300, |
|
213 | - 12300, |
|
214 | - ], |
|
215 | - [ |
|
216 | - 12301, |
|
217 | - 12301, |
|
218 | - ], |
|
219 | - [ |
|
220 | - 12302, |
|
221 | - 12302, |
|
222 | - ], |
|
223 | - [ |
|
224 | - 12303, |
|
225 | - 12303, |
|
226 | - ], |
|
227 | - [ |
|
228 | - 12304, |
|
229 | - 12304, |
|
230 | - ], |
|
231 | - [ |
|
232 | - 12305, |
|
233 | - 12305, |
|
234 | - ], |
|
235 | - [ |
|
236 | - 12306, |
|
237 | - 12307, |
|
238 | - ], |
|
239 | - [ |
|
240 | - 12308, |
|
241 | - 12308, |
|
242 | - ], |
|
243 | - [ |
|
244 | - 12309, |
|
245 | - 12309, |
|
246 | - ], |
|
247 | - [ |
|
248 | - 12310, |
|
249 | - 12310, |
|
250 | - ], |
|
251 | - [ |
|
252 | - 12311, |
|
253 | - 12311, |
|
254 | - ], |
|
255 | - [ |
|
256 | - 12312, |
|
257 | - 12312, |
|
258 | - ], |
|
259 | - [ |
|
260 | - 12313, |
|
261 | - 12313, |
|
262 | - ], |
|
263 | - [ |
|
264 | - 12314, |
|
265 | - 12314, |
|
266 | - ], |
|
267 | - [ |
|
268 | - 12315, |
|
269 | - 12315, |
|
270 | - ], |
|
271 | - [ |
|
272 | - 12316, |
|
273 | - 12316, |
|
274 | - ], |
|
275 | - [ |
|
276 | - 12317, |
|
277 | - 12317, |
|
278 | - ], |
|
279 | - [ |
|
280 | - 12318, |
|
281 | - 12319, |
|
282 | - ], |
|
283 | - [ |
|
284 | - 12320, |
|
285 | - 12320, |
|
286 | - ], |
|
287 | - [ |
|
288 | - 12321, |
|
289 | - 12329, |
|
290 | - ], |
|
291 | - [ |
|
292 | - 12330, |
|
293 | - 12333, |
|
294 | - ], |
|
295 | - [ |
|
296 | - 12334, |
|
297 | - 12335, |
|
298 | - ], |
|
299 | - [ |
|
300 | - 12336, |
|
301 | - 12336, |
|
302 | - ], |
|
303 | - [ |
|
304 | - 12337, |
|
305 | - 12341, |
|
306 | - ], |
|
307 | - [ |
|
308 | - 12342, |
|
309 | - 12343, |
|
310 | - ], |
|
311 | - [ |
|
312 | - 12344, |
|
313 | - 12346, |
|
314 | - ], |
|
315 | - [ |
|
316 | - 12347, |
|
317 | - 12347, |
|
318 | - ], |
|
319 | - [ |
|
320 | - 12348, |
|
321 | - 12348, |
|
322 | - ], |
|
323 | - [ |
|
324 | - 12349, |
|
325 | - 12349, |
|
326 | - ], |
|
327 | - [ |
|
328 | - 12350, |
|
329 | - 12350, |
|
330 | - ], |
|
331 | - [ |
|
332 | - 12353, |
|
333 | - 12438, |
|
334 | - ], |
|
335 | - [ |
|
336 | - 12441, |
|
337 | - 12442, |
|
338 | - ], |
|
339 | - [ |
|
340 | - 12443, |
|
341 | - 12444, |
|
342 | - ], |
|
343 | - [ |
|
344 | - 12445, |
|
345 | - 12446, |
|
346 | - ], |
|
347 | - [ |
|
348 | - 12447, |
|
349 | - 12447, |
|
350 | - ], |
|
351 | - [ |
|
352 | - 12448, |
|
353 | - 12448, |
|
354 | - ], |
|
355 | - [ |
|
356 | - 12449, |
|
357 | - 12538, |
|
358 | - ], |
|
359 | - [ |
|
360 | - 12539, |
|
361 | - 12539, |
|
362 | - ], |
|
363 | - [ |
|
364 | - 12540, |
|
365 | - 12542, |
|
366 | - ], |
|
367 | - [ |
|
368 | - 12543, |
|
369 | - 12543, |
|
370 | - ], |
|
371 | - [ |
|
372 | - 12549, |
|
373 | - 12591, |
|
374 | - ], |
|
375 | - [ |
|
376 | - 12593, |
|
377 | - 12686, |
|
378 | - ], |
|
379 | - [ |
|
380 | - 12688, |
|
381 | - 12689, |
|
382 | - ], |
|
383 | - [ |
|
384 | - 12690, |
|
385 | - 12693, |
|
386 | - ], |
|
387 | - [ |
|
388 | - 12694, |
|
389 | - 12703, |
|
390 | - ], |
|
391 | - [ |
|
392 | - 12704, |
|
393 | - 12735, |
|
394 | - ], |
|
395 | - [ |
|
396 | - 12736, |
|
397 | - 12771, |
|
398 | - ], |
|
399 | - [ |
|
400 | - 12784, |
|
401 | - 12799, |
|
402 | - ], |
|
403 | - [ |
|
404 | - 12800, |
|
405 | - 12830, |
|
406 | - ], |
|
407 | - [ |
|
408 | - 12832, |
|
409 | - 12841, |
|
410 | - ], |
|
411 | - [ |
|
412 | - 12842, |
|
413 | - 12871, |
|
414 | - ], |
|
415 | - [ |
|
416 | - 12880, |
|
417 | - 12880, |
|
418 | - ], |
|
419 | - [ |
|
420 | - 12881, |
|
421 | - 12895, |
|
422 | - ], |
|
423 | - [ |
|
424 | - 12896, |
|
425 | - 12927, |
|
426 | - ], |
|
427 | - [ |
|
428 | - 12928, |
|
429 | - 12937, |
|
430 | - ], |
|
431 | - [ |
|
432 | - 12938, |
|
433 | - 12976, |
|
434 | - ], |
|
435 | - [ |
|
436 | - 12977, |
|
437 | - 12991, |
|
438 | - ], |
|
439 | - [ |
|
440 | - 12992, |
|
441 | - 13055, |
|
442 | - ], |
|
443 | - [ |
|
444 | - 13056, |
|
445 | - 13311, |
|
446 | - ], |
|
447 | - [ |
|
448 | - 13312, |
|
449 | - 19903, |
|
450 | - ], |
|
451 | - [ |
|
452 | - 19968, |
|
453 | - 40956, |
|
454 | - ], |
|
455 | - [ |
|
456 | - 40957, |
|
457 | - 40959, |
|
458 | - ], |
|
459 | - [ |
|
460 | - 40960, |
|
461 | - 40980, |
|
462 | - ], |
|
463 | - [ |
|
464 | - 40981, |
|
465 | - 40981, |
|
466 | - ], |
|
467 | - [ |
|
468 | - 40982, |
|
469 | - 42124, |
|
470 | - ], |
|
471 | - [ |
|
472 | - 42128, |
|
473 | - 42182, |
|
474 | - ], |
|
475 | - [ |
|
476 | - 43360, |
|
477 | - 43388, |
|
478 | - ], |
|
479 | - [ |
|
480 | - 44032, |
|
481 | - 55203, |
|
482 | - ], |
|
483 | - [ |
|
484 | - 63744, |
|
485 | - 64109, |
|
486 | - ], |
|
487 | - [ |
|
488 | - 64110, |
|
489 | - 64111, |
|
490 | - ], |
|
491 | - [ |
|
492 | - 64112, |
|
493 | - 64217, |
|
494 | - ], |
|
495 | - [ |
|
496 | - 64218, |
|
497 | - 64255, |
|
498 | - ], |
|
499 | - [ |
|
500 | - 65040, |
|
501 | - 65046, |
|
502 | - ], |
|
503 | - [ |
|
504 | - 65047, |
|
505 | - 65047, |
|
506 | - ], |
|
507 | - [ |
|
508 | - 65048, |
|
509 | - 65048, |
|
510 | - ], |
|
511 | - [ |
|
512 | - 65049, |
|
513 | - 65049, |
|
514 | - ], |
|
515 | - [ |
|
516 | - 65072, |
|
517 | - 65072, |
|
518 | - ], |
|
519 | - [ |
|
520 | - 65073, |
|
521 | - 65074, |
|
522 | - ], |
|
523 | - [ |
|
524 | - 65075, |
|
525 | - 65076, |
|
526 | - ], |
|
527 | - [ |
|
528 | - 65077, |
|
529 | - 65077, |
|
530 | - ], |
|
531 | - [ |
|
532 | - 65078, |
|
533 | - 65078, |
|
534 | - ], |
|
535 | - [ |
|
536 | - 65079, |
|
537 | - 65079, |
|
538 | - ], |
|
539 | - [ |
|
540 | - 65080, |
|
541 | - 65080, |
|
542 | - ], |
|
543 | - [ |
|
544 | - 65081, |
|
545 | - 65081, |
|
546 | - ], |
|
547 | - [ |
|
548 | - 65082, |
|
549 | - 65082, |
|
550 | - ], |
|
551 | - [ |
|
552 | - 65083, |
|
553 | - 65083, |
|
554 | - ], |
|
555 | - [ |
|
556 | - 65084, |
|
557 | - 65084, |
|
558 | - ], |
|
559 | - [ |
|
560 | - 65085, |
|
561 | - 65085, |
|
562 | - ], |
|
563 | - [ |
|
564 | - 65086, |
|
565 | - 65086, |
|
566 | - ], |
|
567 | - [ |
|
568 | - 65087, |
|
569 | - 65087, |
|
570 | - ], |
|
571 | - [ |
|
572 | - 65088, |
|
573 | - 65088, |
|
574 | - ], |
|
575 | - [ |
|
576 | - 65089, |
|
577 | - 65089, |
|
578 | - ], |
|
579 | - [ |
|
580 | - 65090, |
|
581 | - 65090, |
|
582 | - ], |
|
583 | - [ |
|
584 | - 65091, |
|
585 | - 65091, |
|
586 | - ], |
|
587 | - [ |
|
588 | - 65092, |
|
589 | - 65092, |
|
590 | - ], |
|
591 | - [ |
|
592 | - 65093, |
|
593 | - 65094, |
|
594 | - ], |
|
595 | - [ |
|
596 | - 65095, |
|
597 | - 65095, |
|
598 | - ], |
|
599 | - [ |
|
600 | - 65096, |
|
601 | - 65096, |
|
602 | - ], |
|
603 | - [ |
|
604 | - 65097, |
|
605 | - 65100, |
|
606 | - ], |
|
607 | - [ |
|
608 | - 65101, |
|
609 | - 65103, |
|
610 | - ], |
|
611 | - [ |
|
612 | - 65104, |
|
613 | - 65106, |
|
614 | - ], |
|
615 | - [ |
|
616 | - 65108, |
|
617 | - 65111, |
|
618 | - ], |
|
619 | - [ |
|
620 | - 65112, |
|
621 | - 65112, |
|
622 | - ], |
|
623 | - [ |
|
624 | - 65113, |
|
625 | - 65113, |
|
626 | - ], |
|
627 | - [ |
|
628 | - 65114, |
|
629 | - 65114, |
|
630 | - ], |
|
631 | - [ |
|
632 | - 65115, |
|
633 | - 65115, |
|
634 | - ], |
|
635 | - [ |
|
636 | - 65116, |
|
637 | - 65116, |
|
638 | - ], |
|
639 | - [ |
|
640 | - 65117, |
|
641 | - 65117, |
|
642 | - ], |
|
643 | - [ |
|
644 | - 65118, |
|
645 | - 65118, |
|
646 | - ], |
|
647 | - [ |
|
648 | - 65119, |
|
649 | - 65121, |
|
650 | - ], |
|
651 | - [ |
|
652 | - 65122, |
|
653 | - 65122, |
|
654 | - ], |
|
655 | - [ |
|
656 | - 65123, |
|
657 | - 65123, |
|
658 | - ], |
|
659 | - [ |
|
660 | - 65124, |
|
661 | - 65126, |
|
662 | - ], |
|
663 | - [ |
|
664 | - 65128, |
|
665 | - 65128, |
|
666 | - ], |
|
667 | - [ |
|
668 | - 65129, |
|
669 | - 65129, |
|
670 | - ], |
|
671 | - [ |
|
672 | - 65130, |
|
673 | - 65131, |
|
674 | - ], |
|
675 | - [ |
|
676 | - 65281, |
|
677 | - 65283, |
|
678 | - ], |
|
679 | - [ |
|
680 | - 65284, |
|
681 | - 65284, |
|
682 | - ], |
|
683 | - [ |
|
684 | - 65285, |
|
685 | - 65287, |
|
686 | - ], |
|
687 | - [ |
|
688 | - 65288, |
|
689 | - 65288, |
|
690 | - ], |
|
691 | - [ |
|
692 | - 65289, |
|
693 | - 65289, |
|
694 | - ], |
|
695 | - [ |
|
696 | - 65290, |
|
697 | - 65290, |
|
698 | - ], |
|
699 | - [ |
|
700 | - 65291, |
|
701 | - 65291, |
|
702 | - ], |
|
703 | - [ |
|
704 | - 65292, |
|
705 | - 65292, |
|
706 | - ], |
|
707 | - [ |
|
708 | - 65293, |
|
709 | - 65293, |
|
710 | - ], |
|
711 | - [ |
|
712 | - 65294, |
|
713 | - 65295, |
|
714 | - ], |
|
715 | - [ |
|
716 | - 65296, |
|
717 | - 65305, |
|
718 | - ], |
|
719 | - [ |
|
720 | - 65306, |
|
721 | - 65307, |
|
722 | - ], |
|
723 | - [ |
|
724 | - 65308, |
|
725 | - 65310, |
|
726 | - ], |
|
727 | - [ |
|
728 | - 65311, |
|
729 | - 65312, |
|
730 | - ], |
|
731 | - [ |
|
732 | - 65313, |
|
733 | - 65338, |
|
734 | - ], |
|
735 | - [ |
|
736 | - 65339, |
|
737 | - 65339, |
|
738 | - ], |
|
739 | - [ |
|
740 | - 65340, |
|
741 | - 65340, |
|
742 | - ], |
|
743 | - [ |
|
744 | - 65341, |
|
745 | - 65341, |
|
746 | - ], |
|
747 | - [ |
|
748 | - 65342, |
|
749 | - 65342, |
|
750 | - ], |
|
751 | - [ |
|
752 | - 65343, |
|
753 | - 65343, |
|
754 | - ], |
|
755 | - [ |
|
756 | - 65344, |
|
757 | - 65344, |
|
758 | - ], |
|
759 | - [ |
|
760 | - 65345, |
|
761 | - 65370, |
|
762 | - ], |
|
763 | - [ |
|
764 | - 65371, |
|
765 | - 65371, |
|
766 | - ], |
|
767 | - [ |
|
768 | - 65372, |
|
769 | - 65372, |
|
770 | - ], |
|
771 | - [ |
|
772 | - 65373, |
|
773 | - 65373, |
|
774 | - ], |
|
775 | - [ |
|
776 | - 65374, |
|
777 | - 65374, |
|
778 | - ], |
|
779 | - [ |
|
780 | - 65375, |
|
781 | - 65375, |
|
782 | - ], |
|
783 | - [ |
|
784 | - 65376, |
|
785 | - 65376, |
|
786 | - ], |
|
787 | - [ |
|
788 | - 65504, |
|
789 | - 65505, |
|
790 | - ], |
|
791 | - [ |
|
792 | - 65506, |
|
793 | - 65506, |
|
794 | - ], |
|
795 | - [ |
|
796 | - 65507, |
|
797 | - 65507, |
|
798 | - ], |
|
799 | - [ |
|
800 | - 65508, |
|
801 | - 65508, |
|
802 | - ], |
|
803 | - [ |
|
804 | - 65509, |
|
805 | - 65510, |
|
806 | - ], |
|
807 | - [ |
|
808 | - 94176, |
|
809 | - 94177, |
|
810 | - ], |
|
811 | - [ |
|
812 | - 94178, |
|
813 | - 94178, |
|
814 | - ], |
|
815 | - [ |
|
816 | - 94179, |
|
817 | - 94179, |
|
818 | - ], |
|
819 | - [ |
|
820 | - 94180, |
|
821 | - 94180, |
|
822 | - ], |
|
823 | - [ |
|
824 | - 94192, |
|
825 | - 94193, |
|
826 | - ], |
|
827 | - [ |
|
828 | - 94208, |
|
829 | - 100343, |
|
830 | - ], |
|
831 | - [ |
|
832 | - 100352, |
|
833 | - 101119, |
|
834 | - ], |
|
835 | - [ |
|
836 | - 101120, |
|
837 | - 101589, |
|
838 | - ], |
|
839 | - [ |
|
840 | - 101632, |
|
841 | - 101640, |
|
842 | - ], |
|
843 | - [ |
|
844 | - 110592, |
|
845 | - 110847, |
|
846 | - ], |
|
847 | - [ |
|
848 | - 110848, |
|
849 | - 110878, |
|
850 | - ], |
|
851 | - [ |
|
852 | - 110928, |
|
853 | - 110930, |
|
854 | - ], |
|
855 | - [ |
|
856 | - 110948, |
|
857 | - 110951, |
|
858 | - ], |
|
859 | - [ |
|
860 | - 110960, |
|
861 | - 111355, |
|
862 | - ], |
|
863 | - [ |
|
864 | - 126980, |
|
865 | - 126980, |
|
866 | - ], |
|
867 | - [ |
|
868 | - 127183, |
|
869 | - 127183, |
|
870 | - ], |
|
871 | - [ |
|
872 | - 127374, |
|
873 | - 127374, |
|
874 | - ], |
|
875 | - [ |
|
876 | - 127377, |
|
877 | - 127386, |
|
878 | - ], |
|
879 | - [ |
|
880 | - 127488, |
|
881 | - 127490, |
|
882 | - ], |
|
883 | - [ |
|
884 | - 127504, |
|
885 | - 127547, |
|
886 | - ], |
|
887 | - [ |
|
888 | - 127552, |
|
889 | - 127560, |
|
890 | - ], |
|
891 | - [ |
|
892 | - 127568, |
|
893 | - 127569, |
|
894 | - ], |
|
895 | - [ |
|
896 | - 127584, |
|
897 | - 127589, |
|
898 | - ], |
|
899 | - [ |
|
900 | - 127744, |
|
901 | - 127776, |
|
902 | - ], |
|
903 | - [ |
|
904 | - 127789, |
|
905 | - 127797, |
|
906 | - ], |
|
907 | - [ |
|
908 | - 127799, |
|
909 | - 127868, |
|
910 | - ], |
|
911 | - [ |
|
912 | - 127870, |
|
913 | - 127891, |
|
914 | - ], |
|
915 | - [ |
|
916 | - 127904, |
|
917 | - 127946, |
|
918 | - ], |
|
919 | - [ |
|
920 | - 127951, |
|
921 | - 127955, |
|
922 | - ], |
|
923 | - [ |
|
924 | - 127968, |
|
925 | - 127984, |
|
926 | - ], |
|
927 | - [ |
|
928 | - 127988, |
|
929 | - 127988, |
|
930 | - ], |
|
931 | - [ |
|
932 | - 127992, |
|
933 | - 127994, |
|
934 | - ], |
|
935 | - [ |
|
936 | - 127995, |
|
937 | - 127999, |
|
938 | - ], |
|
939 | - [ |
|
940 | - 128000, |
|
941 | - 128062, |
|
942 | - ], |
|
943 | - [ |
|
944 | - 128064, |
|
945 | - 128064, |
|
946 | - ], |
|
947 | - [ |
|
948 | - 128066, |
|
949 | - 128252, |
|
950 | - ], |
|
951 | - [ |
|
952 | - 128255, |
|
953 | - 128317, |
|
954 | - ], |
|
955 | - [ |
|
956 | - 128331, |
|
957 | - 128334, |
|
958 | - ], |
|
959 | - [ |
|
960 | - 128336, |
|
961 | - 128359, |
|
962 | - ], |
|
963 | - [ |
|
964 | - 128378, |
|
965 | - 128378, |
|
966 | - ], |
|
967 | - [ |
|
968 | - 128405, |
|
969 | - 128406, |
|
970 | - ], |
|
971 | - [ |
|
972 | - 128420, |
|
973 | - 128420, |
|
974 | - ], |
|
975 | - [ |
|
976 | - 128507, |
|
977 | - 128511, |
|
978 | - ], |
|
979 | - [ |
|
980 | - 128512, |
|
981 | - 128591, |
|
982 | - ], |
|
983 | - [ |
|
984 | - 128640, |
|
985 | - 128709, |
|
986 | - ], |
|
987 | - [ |
|
988 | - 128716, |
|
989 | - 128716, |
|
990 | - ], |
|
991 | - [ |
|
992 | - 128720, |
|
993 | - 128722, |
|
994 | - ], |
|
995 | - [ |
|
996 | - 128725, |
|
997 | - 128727, |
|
998 | - ], |
|
999 | - [ |
|
1000 | - 128747, |
|
1001 | - 128748, |
|
1002 | - ], |
|
1003 | - [ |
|
1004 | - 128756, |
|
1005 | - 128764, |
|
1006 | - ], |
|
1007 | - [ |
|
1008 | - 128992, |
|
1009 | - 129003, |
|
1010 | - ], |
|
1011 | - [ |
|
1012 | - 129292, |
|
1013 | - 129338, |
|
1014 | - ], |
|
1015 | - [ |
|
1016 | - 129340, |
|
1017 | - 129349, |
|
1018 | - ], |
|
1019 | - [ |
|
1020 | - 129351, |
|
1021 | - 129400, |
|
1022 | - ], |
|
1023 | - [ |
|
1024 | - 129402, |
|
1025 | - 129483, |
|
1026 | - ], |
|
1027 | - [ |
|
1028 | - 129485, |
|
1029 | - 129535, |
|
1030 | - ], |
|
1031 | - [ |
|
1032 | - 129648, |
|
1033 | - 129652, |
|
1034 | - ], |
|
1035 | - [ |
|
1036 | - 129656, |
|
1037 | - 129658, |
|
1038 | - ], |
|
1039 | - [ |
|
1040 | - 129664, |
|
1041 | - 129670, |
|
1042 | - ], |
|
1043 | - [ |
|
1044 | - 129680, |
|
1045 | - 129704, |
|
1046 | - ], |
|
1047 | - [ |
|
1048 | - 129712, |
|
1049 | - 129718, |
|
1050 | - ], |
|
1051 | - [ |
|
1052 | - 129728, |
|
1053 | - 129730, |
|
1054 | - ], |
|
1055 | - [ |
|
1056 | - 129744, |
|
1057 | - 129750, |
|
1058 | - ], |
|
1059 | - [ |
|
1060 | - 131072, |
|
1061 | - 173789, |
|
1062 | - ], |
|
1063 | - [ |
|
1064 | - 173790, |
|
1065 | - 173823, |
|
1066 | - ], |
|
1067 | - [ |
|
1068 | - 173824, |
|
1069 | - 177972, |
|
1070 | - ], |
|
1071 | - [ |
|
1072 | - 177973, |
|
1073 | - 177983, |
|
1074 | - ], |
|
1075 | - [ |
|
1076 | - 177984, |
|
1077 | - 178205, |
|
1078 | - ], |
|
1079 | - [ |
|
1080 | - 178206, |
|
1081 | - 178207, |
|
1082 | - ], |
|
1083 | - [ |
|
1084 | - 178208, |
|
1085 | - 183969, |
|
1086 | - ], |
|
1087 | - [ |
|
1088 | - 183970, |
|
1089 | - 183983, |
|
1090 | - ], |
|
1091 | - [ |
|
1092 | - 183984, |
|
1093 | - 191456, |
|
1094 | - ], |
|
1095 | - [ |
|
1096 | - 191457, |
|
1097 | - 194559, |
|
1098 | - ], |
|
1099 | - [ |
|
1100 | - 194560, |
|
1101 | - 195101, |
|
1102 | - ], |
|
1103 | - [ |
|
1104 | - 195102, |
|
1105 | - 195103, |
|
1106 | - ], |
|
1107 | - [ |
|
1108 | - 195104, |
|
1109 | - 196605, |
|
1110 | - ], |
|
1111 | - [ |
|
1112 | - 196608, |
|
1113 | - 201546, |
|
1114 | - ], |
|
1115 | - [ |
|
1116 | - 201547, |
|
1117 | - 262141, |
|
1118 | - ], |
|
11 | + [ |
|
12 | + 4352, |
|
13 | + 4447, |
|
14 | + ], |
|
15 | + [ |
|
16 | + 8986, |
|
17 | + 8987, |
|
18 | + ], |
|
19 | + [ |
|
20 | + 9001, |
|
21 | + 9001, |
|
22 | + ], |
|
23 | + [ |
|
24 | + 9002, |
|
25 | + 9002, |
|
26 | + ], |
|
27 | + [ |
|
28 | + 9193, |
|
29 | + 9196, |
|
30 | + ], |
|
31 | + [ |
|
32 | + 9200, |
|
33 | + 9200, |
|
34 | + ], |
|
35 | + [ |
|
36 | + 9203, |
|
37 | + 9203, |
|
38 | + ], |
|
39 | + [ |
|
40 | + 9725, |
|
41 | + 9726, |
|
42 | + ], |
|
43 | + [ |
|
44 | + 9748, |
|
45 | + 9749, |
|
46 | + ], |
|
47 | + [ |
|
48 | + 9800, |
|
49 | + 9811, |
|
50 | + ], |
|
51 | + [ |
|
52 | + 9855, |
|
53 | + 9855, |
|
54 | + ], |
|
55 | + [ |
|
56 | + 9875, |
|
57 | + 9875, |
|
58 | + ], |
|
59 | + [ |
|
60 | + 9889, |
|
61 | + 9889, |
|
62 | + ], |
|
63 | + [ |
|
64 | + 9898, |
|
65 | + 9899, |
|
66 | + ], |
|
67 | + [ |
|
68 | + 9917, |
|
69 | + 9918, |
|
70 | + ], |
|
71 | + [ |
|
72 | + 9924, |
|
73 | + 9925, |
|
74 | + ], |
|
75 | + [ |
|
76 | + 9934, |
|
77 | + 9934, |
|
78 | + ], |
|
79 | + [ |
|
80 | + 9940, |
|
81 | + 9940, |
|
82 | + ], |
|
83 | + [ |
|
84 | + 9962, |
|
85 | + 9962, |
|
86 | + ], |
|
87 | + [ |
|
88 | + 9970, |
|
89 | + 9971, |
|
90 | + ], |
|
91 | + [ |
|
92 | + 9973, |
|
93 | + 9973, |
|
94 | + ], |
|
95 | + [ |
|
96 | + 9978, |
|
97 | + 9978, |
|
98 | + ], |
|
99 | + [ |
|
100 | + 9981, |
|
101 | + 9981, |
|
102 | + ], |
|
103 | + [ |
|
104 | + 9989, |
|
105 | + 9989, |
|
106 | + ], |
|
107 | + [ |
|
108 | + 9994, |
|
109 | + 9995, |
|
110 | + ], |
|
111 | + [ |
|
112 | + 10024, |
|
113 | + 10024, |
|
114 | + ], |
|
115 | + [ |
|
116 | + 10060, |
|
117 | + 10060, |
|
118 | + ], |
|
119 | + [ |
|
120 | + 10062, |
|
121 | + 10062, |
|
122 | + ], |
|
123 | + [ |
|
124 | + 10067, |
|
125 | + 10069, |
|
126 | + ], |
|
127 | + [ |
|
128 | + 10071, |
|
129 | + 10071, |
|
130 | + ], |
|
131 | + [ |
|
132 | + 10133, |
|
133 | + 10135, |
|
134 | + ], |
|
135 | + [ |
|
136 | + 10160, |
|
137 | + 10160, |
|
138 | + ], |
|
139 | + [ |
|
140 | + 10175, |
|
141 | + 10175, |
|
142 | + ], |
|
143 | + [ |
|
144 | + 11035, |
|
145 | + 11036, |
|
146 | + ], |
|
147 | + [ |
|
148 | + 11088, |
|
149 | + 11088, |
|
150 | + ], |
|
151 | + [ |
|
152 | + 11093, |
|
153 | + 11093, |
|
154 | + ], |
|
155 | + [ |
|
156 | + 11904, |
|
157 | + 11929, |
|
158 | + ], |
|
159 | + [ |
|
160 | + 11931, |
|
161 | + 12019, |
|
162 | + ], |
|
163 | + [ |
|
164 | + 12032, |
|
165 | + 12245, |
|
166 | + ], |
|
167 | + [ |
|
168 | + 12272, |
|
169 | + 12283, |
|
170 | + ], |
|
171 | + [ |
|
172 | + 12288, |
|
173 | + 12288, |
|
174 | + ], |
|
175 | + [ |
|
176 | + 12289, |
|
177 | + 12291, |
|
178 | + ], |
|
179 | + [ |
|
180 | + 12292, |
|
181 | + 12292, |
|
182 | + ], |
|
183 | + [ |
|
184 | + 12293, |
|
185 | + 12293, |
|
186 | + ], |
|
187 | + [ |
|
188 | + 12294, |
|
189 | + 12294, |
|
190 | + ], |
|
191 | + [ |
|
192 | + 12295, |
|
193 | + 12295, |
|
194 | + ], |
|
195 | + [ |
|
196 | + 12296, |
|
197 | + 12296, |
|
198 | + ], |
|
199 | + [ |
|
200 | + 12297, |
|
201 | + 12297, |
|
202 | + ], |
|
203 | + [ |
|
204 | + 12298, |
|
205 | + 12298, |
|
206 | + ], |
|
207 | + [ |
|
208 | + 12299, |
|
209 | + 12299, |
|
210 | + ], |
|
211 | + [ |
|
212 | + 12300, |
|
213 | + 12300, |
|
214 | + ], |
|
215 | + [ |
|
216 | + 12301, |
|
217 | + 12301, |
|
218 | + ], |
|
219 | + [ |
|
220 | + 12302, |
|
221 | + 12302, |
|
222 | + ], |
|
223 | + [ |
|
224 | + 12303, |
|
225 | + 12303, |
|
226 | + ], |
|
227 | + [ |
|
228 | + 12304, |
|
229 | + 12304, |
|
230 | + ], |
|
231 | + [ |
|
232 | + 12305, |
|
233 | + 12305, |
|
234 | + ], |
|
235 | + [ |
|
236 | + 12306, |
|
237 | + 12307, |
|
238 | + ], |
|
239 | + [ |
|
240 | + 12308, |
|
241 | + 12308, |
|
242 | + ], |
|
243 | + [ |
|
244 | + 12309, |
|
245 | + 12309, |
|
246 | + ], |
|
247 | + [ |
|
248 | + 12310, |
|
249 | + 12310, |
|
250 | + ], |
|
251 | + [ |
|
252 | + 12311, |
|
253 | + 12311, |
|
254 | + ], |
|
255 | + [ |
|
256 | + 12312, |
|
257 | + 12312, |
|
258 | + ], |
|
259 | + [ |
|
260 | + 12313, |
|
261 | + 12313, |
|
262 | + ], |
|
263 | + [ |
|
264 | + 12314, |
|
265 | + 12314, |
|
266 | + ], |
|
267 | + [ |
|
268 | + 12315, |
|
269 | + 12315, |
|
270 | + ], |
|
271 | + [ |
|
272 | + 12316, |
|
273 | + 12316, |
|
274 | + ], |
|
275 | + [ |
|
276 | + 12317, |
|
277 | + 12317, |
|
278 | + ], |
|
279 | + [ |
|
280 | + 12318, |
|
281 | + 12319, |
|
282 | + ], |
|
283 | + [ |
|
284 | + 12320, |
|
285 | + 12320, |
|
286 | + ], |
|
287 | + [ |
|
288 | + 12321, |
|
289 | + 12329, |
|
290 | + ], |
|
291 | + [ |
|
292 | + 12330, |
|
293 | + 12333, |
|
294 | + ], |
|
295 | + [ |
|
296 | + 12334, |
|
297 | + 12335, |
|
298 | + ], |
|
299 | + [ |
|
300 | + 12336, |
|
301 | + 12336, |
|
302 | + ], |
|
303 | + [ |
|
304 | + 12337, |
|
305 | + 12341, |
|
306 | + ], |
|
307 | + [ |
|
308 | + 12342, |
|
309 | + 12343, |
|
310 | + ], |
|
311 | + [ |
|
312 | + 12344, |
|
313 | + 12346, |
|
314 | + ], |
|
315 | + [ |
|
316 | + 12347, |
|
317 | + 12347, |
|
318 | + ], |
|
319 | + [ |
|
320 | + 12348, |
|
321 | + 12348, |
|
322 | + ], |
|
323 | + [ |
|
324 | + 12349, |
|
325 | + 12349, |
|
326 | + ], |
|
327 | + [ |
|
328 | + 12350, |
|
329 | + 12350, |
|
330 | + ], |
|
331 | + [ |
|
332 | + 12353, |
|
333 | + 12438, |
|
334 | + ], |
|
335 | + [ |
|
336 | + 12441, |
|
337 | + 12442, |
|
338 | + ], |
|
339 | + [ |
|
340 | + 12443, |
|
341 | + 12444, |
|
342 | + ], |
|
343 | + [ |
|
344 | + 12445, |
|
345 | + 12446, |
|
346 | + ], |
|
347 | + [ |
|
348 | + 12447, |
|
349 | + 12447, |
|
350 | + ], |
|
351 | + [ |
|
352 | + 12448, |
|
353 | + 12448, |
|
354 | + ], |
|
355 | + [ |
|
356 | + 12449, |
|
357 | + 12538, |
|
358 | + ], |
|
359 | + [ |
|
360 | + 12539, |
|
361 | + 12539, |
|
362 | + ], |
|
363 | + [ |
|
364 | + 12540, |
|
365 | + 12542, |
|
366 | + ], |
|
367 | + [ |
|
368 | + 12543, |
|
369 | + 12543, |
|
370 | + ], |
|
371 | + [ |
|
372 | + 12549, |
|
373 | + 12591, |
|
374 | + ], |
|
375 | + [ |
|
376 | + 12593, |
|
377 | + 12686, |
|
378 | + ], |
|
379 | + [ |
|
380 | + 12688, |
|
381 | + 12689, |
|
382 | + ], |
|
383 | + [ |
|
384 | + 12690, |
|
385 | + 12693, |
|
386 | + ], |
|
387 | + [ |
|
388 | + 12694, |
|
389 | + 12703, |
|
390 | + ], |
|
391 | + [ |
|
392 | + 12704, |
|
393 | + 12735, |
|
394 | + ], |
|
395 | + [ |
|
396 | + 12736, |
|
397 | + 12771, |
|
398 | + ], |
|
399 | + [ |
|
400 | + 12784, |
|
401 | + 12799, |
|
402 | + ], |
|
403 | + [ |
|
404 | + 12800, |
|
405 | + 12830, |
|
406 | + ], |
|
407 | + [ |
|
408 | + 12832, |
|
409 | + 12841, |
|
410 | + ], |
|
411 | + [ |
|
412 | + 12842, |
|
413 | + 12871, |
|
414 | + ], |
|
415 | + [ |
|
416 | + 12880, |
|
417 | + 12880, |
|
418 | + ], |
|
419 | + [ |
|
420 | + 12881, |
|
421 | + 12895, |
|
422 | + ], |
|
423 | + [ |
|
424 | + 12896, |
|
425 | + 12927, |
|
426 | + ], |
|
427 | + [ |
|
428 | + 12928, |
|
429 | + 12937, |
|
430 | + ], |
|
431 | + [ |
|
432 | + 12938, |
|
433 | + 12976, |
|
434 | + ], |
|
435 | + [ |
|
436 | + 12977, |
|
437 | + 12991, |
|
438 | + ], |
|
439 | + [ |
|
440 | + 12992, |
|
441 | + 13055, |
|
442 | + ], |
|
443 | + [ |
|
444 | + 13056, |
|
445 | + 13311, |
|
446 | + ], |
|
447 | + [ |
|
448 | + 13312, |
|
449 | + 19903, |
|
450 | + ], |
|
451 | + [ |
|
452 | + 19968, |
|
453 | + 40956, |
|
454 | + ], |
|
455 | + [ |
|
456 | + 40957, |
|
457 | + 40959, |
|
458 | + ], |
|
459 | + [ |
|
460 | + 40960, |
|
461 | + 40980, |
|
462 | + ], |
|
463 | + [ |
|
464 | + 40981, |
|
465 | + 40981, |
|
466 | + ], |
|
467 | + [ |
|
468 | + 40982, |
|
469 | + 42124, |
|
470 | + ], |
|
471 | + [ |
|
472 | + 42128, |
|
473 | + 42182, |
|
474 | + ], |
|
475 | + [ |
|
476 | + 43360, |
|
477 | + 43388, |
|
478 | + ], |
|
479 | + [ |
|
480 | + 44032, |
|
481 | + 55203, |
|
482 | + ], |
|
483 | + [ |
|
484 | + 63744, |
|
485 | + 64109, |
|
486 | + ], |
|
487 | + [ |
|
488 | + 64110, |
|
489 | + 64111, |
|
490 | + ], |
|
491 | + [ |
|
492 | + 64112, |
|
493 | + 64217, |
|
494 | + ], |
|
495 | + [ |
|
496 | + 64218, |
|
497 | + 64255, |
|
498 | + ], |
|
499 | + [ |
|
500 | + 65040, |
|
501 | + 65046, |
|
502 | + ], |
|
503 | + [ |
|
504 | + 65047, |
|
505 | + 65047, |
|
506 | + ], |
|
507 | + [ |
|
508 | + 65048, |
|
509 | + 65048, |
|
510 | + ], |
|
511 | + [ |
|
512 | + 65049, |
|
513 | + 65049, |
|
514 | + ], |
|
515 | + [ |
|
516 | + 65072, |
|
517 | + 65072, |
|
518 | + ], |
|
519 | + [ |
|
520 | + 65073, |
|
521 | + 65074, |
|
522 | + ], |
|
523 | + [ |
|
524 | + 65075, |
|
525 | + 65076, |
|
526 | + ], |
|
527 | + [ |
|
528 | + 65077, |
|
529 | + 65077, |
|
530 | + ], |
|
531 | + [ |
|
532 | + 65078, |
|
533 | + 65078, |
|
534 | + ], |
|
535 | + [ |
|
536 | + 65079, |
|
537 | + 65079, |
|
538 | + ], |
|
539 | + [ |
|
540 | + 65080, |
|
541 | + 65080, |
|
542 | + ], |
|
543 | + [ |
|
544 | + 65081, |
|
545 | + 65081, |
|
546 | + ], |
|
547 | + [ |
|
548 | + 65082, |
|
549 | + 65082, |
|
550 | + ], |
|
551 | + [ |
|
552 | + 65083, |
|
553 | + 65083, |
|
554 | + ], |
|
555 | + [ |
|
556 | + 65084, |
|
557 | + 65084, |
|
558 | + ], |
|
559 | + [ |
|
560 | + 65085, |
|
561 | + 65085, |
|
562 | + ], |
|
563 | + [ |
|
564 | + 65086, |
|
565 | + 65086, |
|
566 | + ], |
|
567 | + [ |
|
568 | + 65087, |
|
569 | + 65087, |
|
570 | + ], |
|
571 | + [ |
|
572 | + 65088, |
|
573 | + 65088, |
|
574 | + ], |
|
575 | + [ |
|
576 | + 65089, |
|
577 | + 65089, |
|
578 | + ], |
|
579 | + [ |
|
580 | + 65090, |
|
581 | + 65090, |
|
582 | + ], |
|
583 | + [ |
|
584 | + 65091, |
|
585 | + 65091, |
|
586 | + ], |
|
587 | + [ |
|
588 | + 65092, |
|
589 | + 65092, |
|
590 | + ], |
|
591 | + [ |
|
592 | + 65093, |
|
593 | + 65094, |
|
594 | + ], |
|
595 | + [ |
|
596 | + 65095, |
|
597 | + 65095, |
|
598 | + ], |
|
599 | + [ |
|
600 | + 65096, |
|
601 | + 65096, |
|
602 | + ], |
|
603 | + [ |
|
604 | + 65097, |
|
605 | + 65100, |
|
606 | + ], |
|
607 | + [ |
|
608 | + 65101, |
|
609 | + 65103, |
|
610 | + ], |
|
611 | + [ |
|
612 | + 65104, |
|
613 | + 65106, |
|
614 | + ], |
|
615 | + [ |
|
616 | + 65108, |
|
617 | + 65111, |
|
618 | + ], |
|
619 | + [ |
|
620 | + 65112, |
|
621 | + 65112, |
|
622 | + ], |
|
623 | + [ |
|
624 | + 65113, |
|
625 | + 65113, |
|
626 | + ], |
|
627 | + [ |
|
628 | + 65114, |
|
629 | + 65114, |
|
630 | + ], |
|
631 | + [ |
|
632 | + 65115, |
|
633 | + 65115, |
|
634 | + ], |
|
635 | + [ |
|
636 | + 65116, |
|
637 | + 65116, |
|
638 | + ], |
|
639 | + [ |
|
640 | + 65117, |
|
641 | + 65117, |
|
642 | + ], |
|
643 | + [ |
|
644 | + 65118, |
|
645 | + 65118, |
|
646 | + ], |
|
647 | + [ |
|
648 | + 65119, |
|
649 | + 65121, |
|
650 | + ], |
|
651 | + [ |
|
652 | + 65122, |
|
653 | + 65122, |
|
654 | + ], |
|
655 | + [ |
|
656 | + 65123, |
|
657 | + 65123, |
|
658 | + ], |
|
659 | + [ |
|
660 | + 65124, |
|
661 | + 65126, |
|
662 | + ], |
|
663 | + [ |
|
664 | + 65128, |
|
665 | + 65128, |
|
666 | + ], |
|
667 | + [ |
|
668 | + 65129, |
|
669 | + 65129, |
|
670 | + ], |
|
671 | + [ |
|
672 | + 65130, |
|
673 | + 65131, |
|
674 | + ], |
|
675 | + [ |
|
676 | + 65281, |
|
677 | + 65283, |
|
678 | + ], |
|
679 | + [ |
|
680 | + 65284, |
|
681 | + 65284, |
|
682 | + ], |
|
683 | + [ |
|
684 | + 65285, |
|
685 | + 65287, |
|
686 | + ], |
|
687 | + [ |
|
688 | + 65288, |
|
689 | + 65288, |
|
690 | + ], |
|
691 | + [ |
|
692 | + 65289, |
|
693 | + 65289, |
|
694 | + ], |
|
695 | + [ |
|
696 | + 65290, |
|
697 | + 65290, |
|
698 | + ], |
|
699 | + [ |
|
700 | + 65291, |
|
701 | + 65291, |
|
702 | + ], |
|
703 | + [ |
|
704 | + 65292, |
|
705 | + 65292, |
|
706 | + ], |
|
707 | + [ |
|
708 | + 65293, |
|
709 | + 65293, |
|
710 | + ], |
|
711 | + [ |
|
712 | + 65294, |
|
713 | + 65295, |
|
714 | + ], |
|
715 | + [ |
|
716 | + 65296, |
|
717 | + 65305, |
|
718 | + ], |
|
719 | + [ |
|
720 | + 65306, |
|
721 | + 65307, |
|
722 | + ], |
|
723 | + [ |
|
724 | + 65308, |
|
725 | + 65310, |
|
726 | + ], |
|
727 | + [ |
|
728 | + 65311, |
|
729 | + 65312, |
|
730 | + ], |
|
731 | + [ |
|
732 | + 65313, |
|
733 | + 65338, |
|
734 | + ], |
|
735 | + [ |
|
736 | + 65339, |
|
737 | + 65339, |
|
738 | + ], |
|
739 | + [ |
|
740 | + 65340, |
|
741 | + 65340, |
|
742 | + ], |
|
743 | + [ |
|
744 | + 65341, |
|
745 | + 65341, |
|
746 | + ], |
|
747 | + [ |
|
748 | + 65342, |
|
749 | + 65342, |
|
750 | + ], |
|
751 | + [ |
|
752 | + 65343, |
|
753 | + 65343, |
|
754 | + ], |
|
755 | + [ |
|
756 | + 65344, |
|
757 | + 65344, |
|
758 | + ], |
|
759 | + [ |
|
760 | + 65345, |
|
761 | + 65370, |
|
762 | + ], |
|
763 | + [ |
|
764 | + 65371, |
|
765 | + 65371, |
|
766 | + ], |
|
767 | + [ |
|
768 | + 65372, |
|
769 | + 65372, |
|
770 | + ], |
|
771 | + [ |
|
772 | + 65373, |
|
773 | + 65373, |
|
774 | + ], |
|
775 | + [ |
|
776 | + 65374, |
|
777 | + 65374, |
|
778 | + ], |
|
779 | + [ |
|
780 | + 65375, |
|
781 | + 65375, |
|
782 | + ], |
|
783 | + [ |
|
784 | + 65376, |
|
785 | + 65376, |
|
786 | + ], |
|
787 | + [ |
|
788 | + 65504, |
|
789 | + 65505, |
|
790 | + ], |
|
791 | + [ |
|
792 | + 65506, |
|
793 | + 65506, |
|
794 | + ], |
|
795 | + [ |
|
796 | + 65507, |
|
797 | + 65507, |
|
798 | + ], |
|
799 | + [ |
|
800 | + 65508, |
|
801 | + 65508, |
|
802 | + ], |
|
803 | + [ |
|
804 | + 65509, |
|
805 | + 65510, |
|
806 | + ], |
|
807 | + [ |
|
808 | + 94176, |
|
809 | + 94177, |
|
810 | + ], |
|
811 | + [ |
|
812 | + 94178, |
|
813 | + 94178, |
|
814 | + ], |
|
815 | + [ |
|
816 | + 94179, |
|
817 | + 94179, |
|
818 | + ], |
|
819 | + [ |
|
820 | + 94180, |
|
821 | + 94180, |
|
822 | + ], |
|
823 | + [ |
|
824 | + 94192, |
|
825 | + 94193, |
|
826 | + ], |
|
827 | + [ |
|
828 | + 94208, |
|
829 | + 100343, |
|
830 | + ], |
|
831 | + [ |
|
832 | + 100352, |
|
833 | + 101119, |
|
834 | + ], |
|
835 | + [ |
|
836 | + 101120, |
|
837 | + 101589, |
|
838 | + ], |
|
839 | + [ |
|
840 | + 101632, |
|
841 | + 101640, |
|
842 | + ], |
|
843 | + [ |
|
844 | + 110592, |
|
845 | + 110847, |
|
846 | + ], |
|
847 | + [ |
|
848 | + 110848, |
|
849 | + 110878, |
|
850 | + ], |
|
851 | + [ |
|
852 | + 110928, |
|
853 | + 110930, |
|
854 | + ], |
|
855 | + [ |
|
856 | + 110948, |
|
857 | + 110951, |
|
858 | + ], |
|
859 | + [ |
|
860 | + 110960, |
|
861 | + 111355, |
|
862 | + ], |
|
863 | + [ |
|
864 | + 126980, |
|
865 | + 126980, |
|
866 | + ], |
|
867 | + [ |
|
868 | + 127183, |
|
869 | + 127183, |
|
870 | + ], |
|
871 | + [ |
|
872 | + 127374, |
|
873 | + 127374, |
|
874 | + ], |
|
875 | + [ |
|
876 | + 127377, |
|
877 | + 127386, |
|
878 | + ], |
|
879 | + [ |
|
880 | + 127488, |
|
881 | + 127490, |
|
882 | + ], |
|
883 | + [ |
|
884 | + 127504, |
|
885 | + 127547, |
|
886 | + ], |
|
887 | + [ |
|
888 | + 127552, |
|
889 | + 127560, |
|
890 | + ], |
|
891 | + [ |
|
892 | + 127568, |
|
893 | + 127569, |
|
894 | + ], |
|
895 | + [ |
|
896 | + 127584, |
|
897 | + 127589, |
|
898 | + ], |
|
899 | + [ |
|
900 | + 127744, |
|
901 | + 127776, |
|
902 | + ], |
|
903 | + [ |
|
904 | + 127789, |
|
905 | + 127797, |
|
906 | + ], |
|
907 | + [ |
|
908 | + 127799, |
|
909 | + 127868, |
|
910 | + ], |
|
911 | + [ |
|
912 | + 127870, |
|
913 | + 127891, |
|
914 | + ], |
|
915 | + [ |
|
916 | + 127904, |
|
917 | + 127946, |
|
918 | + ], |
|
919 | + [ |
|
920 | + 127951, |
|
921 | + 127955, |
|
922 | + ], |
|
923 | + [ |
|
924 | + 127968, |
|
925 | + 127984, |
|
926 | + ], |
|
927 | + [ |
|
928 | + 127988, |
|
929 | + 127988, |
|
930 | + ], |
|
931 | + [ |
|
932 | + 127992, |
|
933 | + 127994, |
|
934 | + ], |
|
935 | + [ |
|
936 | + 127995, |
|
937 | + 127999, |
|
938 | + ], |
|
939 | + [ |
|
940 | + 128000, |
|
941 | + 128062, |
|
942 | + ], |
|
943 | + [ |
|
944 | + 128064, |
|
945 | + 128064, |
|
946 | + ], |
|
947 | + [ |
|
948 | + 128066, |
|
949 | + 128252, |
|
950 | + ], |
|
951 | + [ |
|
952 | + 128255, |
|
953 | + 128317, |
|
954 | + ], |
|
955 | + [ |
|
956 | + 128331, |
|
957 | + 128334, |
|
958 | + ], |
|
959 | + [ |
|
960 | + 128336, |
|
961 | + 128359, |
|
962 | + ], |
|
963 | + [ |
|
964 | + 128378, |
|
965 | + 128378, |
|
966 | + ], |
|
967 | + [ |
|
968 | + 128405, |
|
969 | + 128406, |
|
970 | + ], |
|
971 | + [ |
|
972 | + 128420, |
|
973 | + 128420, |
|
974 | + ], |
|
975 | + [ |
|
976 | + 128507, |
|
977 | + 128511, |
|
978 | + ], |
|
979 | + [ |
|
980 | + 128512, |
|
981 | + 128591, |
|
982 | + ], |
|
983 | + [ |
|
984 | + 128640, |
|
985 | + 128709, |
|
986 | + ], |
|
987 | + [ |
|
988 | + 128716, |
|
989 | + 128716, |
|
990 | + ], |
|
991 | + [ |
|
992 | + 128720, |
|
993 | + 128722, |
|
994 | + ], |
|
995 | + [ |
|
996 | + 128725, |
|
997 | + 128727, |
|
998 | + ], |
|
999 | + [ |
|
1000 | + 128747, |
|
1001 | + 128748, |
|
1002 | + ], |
|
1003 | + [ |
|
1004 | + 128756, |
|
1005 | + 128764, |
|
1006 | + ], |
|
1007 | + [ |
|
1008 | + 128992, |
|
1009 | + 129003, |
|
1010 | + ], |
|
1011 | + [ |
|
1012 | + 129292, |
|
1013 | + 129338, |
|
1014 | + ], |
|
1015 | + [ |
|
1016 | + 129340, |
|
1017 | + 129349, |
|
1018 | + ], |
|
1019 | + [ |
|
1020 | + 129351, |
|
1021 | + 129400, |
|
1022 | + ], |
|
1023 | + [ |
|
1024 | + 129402, |
|
1025 | + 129483, |
|
1026 | + ], |
|
1027 | + [ |
|
1028 | + 129485, |
|
1029 | + 129535, |
|
1030 | + ], |
|
1031 | + [ |
|
1032 | + 129648, |
|
1033 | + 129652, |
|
1034 | + ], |
|
1035 | + [ |
|
1036 | + 129656, |
|
1037 | + 129658, |
|
1038 | + ], |
|
1039 | + [ |
|
1040 | + 129664, |
|
1041 | + 129670, |
|
1042 | + ], |
|
1043 | + [ |
|
1044 | + 129680, |
|
1045 | + 129704, |
|
1046 | + ], |
|
1047 | + [ |
|
1048 | + 129712, |
|
1049 | + 129718, |
|
1050 | + ], |
|
1051 | + [ |
|
1052 | + 129728, |
|
1053 | + 129730, |
|
1054 | + ], |
|
1055 | + [ |
|
1056 | + 129744, |
|
1057 | + 129750, |
|
1058 | + ], |
|
1059 | + [ |
|
1060 | + 131072, |
|
1061 | + 173789, |
|
1062 | + ], |
|
1063 | + [ |
|
1064 | + 173790, |
|
1065 | + 173823, |
|
1066 | + ], |
|
1067 | + [ |
|
1068 | + 173824, |
|
1069 | + 177972, |
|
1070 | + ], |
|
1071 | + [ |
|
1072 | + 177973, |
|
1073 | + 177983, |
|
1074 | + ], |
|
1075 | + [ |
|
1076 | + 177984, |
|
1077 | + 178205, |
|
1078 | + ], |
|
1079 | + [ |
|
1080 | + 178206, |
|
1081 | + 178207, |
|
1082 | + ], |
|
1083 | + [ |
|
1084 | + 178208, |
|
1085 | + 183969, |
|
1086 | + ], |
|
1087 | + [ |
|
1088 | + 183970, |
|
1089 | + 183983, |
|
1090 | + ], |
|
1091 | + [ |
|
1092 | + 183984, |
|
1093 | + 191456, |
|
1094 | + ], |
|
1095 | + [ |
|
1096 | + 191457, |
|
1097 | + 194559, |
|
1098 | + ], |
|
1099 | + [ |
|
1100 | + 194560, |
|
1101 | + 195101, |
|
1102 | + ], |
|
1103 | + [ |
|
1104 | + 195102, |
|
1105 | + 195103, |
|
1106 | + ], |
|
1107 | + [ |
|
1108 | + 195104, |
|
1109 | + 196605, |
|
1110 | + ], |
|
1111 | + [ |
|
1112 | + 196608, |
|
1113 | + 201546, |
|
1114 | + ], |
|
1115 | + [ |
|
1116 | + 201547, |
|
1117 | + 262141, |
|
1118 | + ], |
|
1119 | 1119 | ]; |
@@ -24,247 +24,247 @@ |
||
24 | 24 | */ |
25 | 25 | class CodePointString extends AbstractUnicodeString |
26 | 26 | { |
27 | - public function __construct(string $string = '') |
|
28 | - { |
|
29 | - if ('' !== $string && !preg_match('//u', $string)) { |
|
30 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
31 | - } |
|
32 | - |
|
33 | - $this->string = $string; |
|
34 | - } |
|
35 | - |
|
36 | - public function append(string ...$suffix): AbstractString |
|
37 | - { |
|
38 | - $str = clone $this; |
|
39 | - $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix); |
|
40 | - |
|
41 | - if (!preg_match('//u', $str->string)) { |
|
42 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
43 | - } |
|
44 | - |
|
45 | - return $str; |
|
46 | - } |
|
47 | - |
|
48 | - public function chunk(int $length = 1): array |
|
49 | - { |
|
50 | - if (1 > $length) { |
|
51 | - throw new InvalidArgumentException('The chunk length must be greater than zero.'); |
|
52 | - } |
|
53 | - |
|
54 | - if ('' === $this->string) { |
|
55 | - return []; |
|
56 | - } |
|
57 | - |
|
58 | - $rx = '/('; |
|
59 | - while (65535 < $length) { |
|
60 | - $rx .= '.{65535}'; |
|
61 | - $length -= 65535; |
|
62 | - } |
|
63 | - $rx .= '.{'.$length.'})/us'; |
|
64 | - |
|
65 | - $str = clone $this; |
|
66 | - $chunks = []; |
|
67 | - |
|
68 | - foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) { |
|
69 | - $str->string = $chunk; |
|
70 | - $chunks[] = clone $str; |
|
71 | - } |
|
72 | - |
|
73 | - return $chunks; |
|
74 | - } |
|
75 | - |
|
76 | - public function codePointsAt(int $offset): array |
|
77 | - { |
|
78 | - $str = $offset ? $this->slice($offset, 1) : $this; |
|
79 | - |
|
80 | - return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')]; |
|
81 | - } |
|
82 | - |
|
83 | - public function endsWith($suffix): bool |
|
84 | - { |
|
85 | - if ($suffix instanceof AbstractString) { |
|
86 | - $suffix = $suffix->string; |
|
87 | - } elseif (\is_array($suffix) || $suffix instanceof \Traversable) { |
|
88 | - return parent::endsWith($suffix); |
|
89 | - } else { |
|
90 | - $suffix = (string) $suffix; |
|
91 | - } |
|
92 | - |
|
93 | - if ('' === $suffix || !preg_match('//u', $suffix)) { |
|
94 | - return false; |
|
95 | - } |
|
96 | - |
|
97 | - if ($this->ignoreCase) { |
|
98 | - return preg_match('{'.preg_quote($suffix).'$}iuD', $this->string); |
|
99 | - } |
|
100 | - |
|
101 | - return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix)); |
|
102 | - } |
|
103 | - |
|
104 | - public function equalsTo($string): bool |
|
105 | - { |
|
106 | - if ($string instanceof AbstractString) { |
|
107 | - $string = $string->string; |
|
108 | - } elseif (\is_array($string) || $string instanceof \Traversable) { |
|
109 | - return parent::equalsTo($string); |
|
110 | - } else { |
|
111 | - $string = (string) $string; |
|
112 | - } |
|
113 | - |
|
114 | - if ('' !== $string && $this->ignoreCase) { |
|
115 | - return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8'); |
|
116 | - } |
|
117 | - |
|
118 | - return $string === $this->string; |
|
119 | - } |
|
120 | - |
|
121 | - public function indexOf($needle, int $offset = 0): ?int |
|
122 | - { |
|
123 | - if ($needle instanceof AbstractString) { |
|
124 | - $needle = $needle->string; |
|
125 | - } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
126 | - return parent::indexOf($needle, $offset); |
|
127 | - } else { |
|
128 | - $needle = (string) $needle; |
|
129 | - } |
|
130 | - |
|
131 | - if ('' === $needle) { |
|
132 | - return null; |
|
133 | - } |
|
134 | - |
|
135 | - $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8'); |
|
136 | - |
|
137 | - return false === $i ? null : $i; |
|
138 | - } |
|
139 | - |
|
140 | - public function indexOfLast($needle, int $offset = 0): ?int |
|
141 | - { |
|
142 | - if ($needle instanceof AbstractString) { |
|
143 | - $needle = $needle->string; |
|
144 | - } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
145 | - return parent::indexOfLast($needle, $offset); |
|
146 | - } else { |
|
147 | - $needle = (string) $needle; |
|
148 | - } |
|
149 | - |
|
150 | - if ('' === $needle) { |
|
151 | - return null; |
|
152 | - } |
|
153 | - |
|
154 | - $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8'); |
|
155 | - |
|
156 | - return false === $i ? null : $i; |
|
157 | - } |
|
158 | - |
|
159 | - public function length(): int |
|
160 | - { |
|
161 | - return mb_strlen($this->string, 'UTF-8'); |
|
162 | - } |
|
163 | - |
|
164 | - public function prepend(string ...$prefix): AbstractString |
|
165 | - { |
|
166 | - $str = clone $this; |
|
167 | - $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string; |
|
168 | - |
|
169 | - if (!preg_match('//u', $str->string)) { |
|
170 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
171 | - } |
|
172 | - |
|
173 | - return $str; |
|
174 | - } |
|
175 | - |
|
176 | - public function replace(string $from, string $to): AbstractString |
|
177 | - { |
|
178 | - $str = clone $this; |
|
179 | - |
|
180 | - if ('' === $from || !preg_match('//u', $from)) { |
|
181 | - return $str; |
|
182 | - } |
|
183 | - |
|
184 | - if ('' !== $to && !preg_match('//u', $to)) { |
|
185 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
186 | - } |
|
187 | - |
|
188 | - if ($this->ignoreCase) { |
|
189 | - $str->string = implode($to, preg_split('{'.preg_quote($from).'}iuD', $this->string)); |
|
190 | - } else { |
|
191 | - $str->string = str_replace($from, $to, $this->string); |
|
192 | - } |
|
193 | - |
|
194 | - return $str; |
|
195 | - } |
|
196 | - |
|
197 | - public function slice(int $start = 0, int $length = null): AbstractString |
|
198 | - { |
|
199 | - $str = clone $this; |
|
200 | - $str->string = mb_substr($this->string, $start, $length, 'UTF-8'); |
|
201 | - |
|
202 | - return $str; |
|
203 | - } |
|
204 | - |
|
205 | - public function splice(string $replacement, int $start = 0, int $length = null): AbstractString |
|
206 | - { |
|
207 | - if (!preg_match('//u', $replacement)) { |
|
208 | - throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
209 | - } |
|
210 | - |
|
211 | - $str = clone $this; |
|
212 | - $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0; |
|
213 | - $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length; |
|
214 | - $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX); |
|
215 | - |
|
216 | - return $str; |
|
217 | - } |
|
218 | - |
|
219 | - public function split(string $delimiter, int $limit = null, int $flags = null): array |
|
220 | - { |
|
221 | - if (1 > $limit = $limit ?? \PHP_INT_MAX) { |
|
222 | - throw new InvalidArgumentException('Split limit must be a positive integer.'); |
|
223 | - } |
|
224 | - |
|
225 | - if ('' === $delimiter) { |
|
226 | - throw new InvalidArgumentException('Split delimiter is empty.'); |
|
227 | - } |
|
228 | - |
|
229 | - if (null !== $flags) { |
|
230 | - return parent::split($delimiter.'u', $limit, $flags); |
|
231 | - } |
|
232 | - |
|
233 | - if (!preg_match('//u', $delimiter)) { |
|
234 | - throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.'); |
|
235 | - } |
|
236 | - |
|
237 | - $str = clone $this; |
|
238 | - $chunks = $this->ignoreCase |
|
239 | - ? preg_split('{'.preg_quote($delimiter).'}iuD', $this->string, $limit) |
|
240 | - : explode($delimiter, $this->string, $limit); |
|
241 | - |
|
242 | - foreach ($chunks as &$chunk) { |
|
243 | - $str->string = $chunk; |
|
244 | - $chunk = clone $str; |
|
245 | - } |
|
246 | - |
|
247 | - return $chunks; |
|
248 | - } |
|
249 | - |
|
250 | - public function startsWith($prefix): bool |
|
251 | - { |
|
252 | - if ($prefix instanceof AbstractString) { |
|
253 | - $prefix = $prefix->string; |
|
254 | - } elseif (\is_array($prefix) || $prefix instanceof \Traversable) { |
|
255 | - return parent::startsWith($prefix); |
|
256 | - } else { |
|
257 | - $prefix = (string) $prefix; |
|
258 | - } |
|
259 | - |
|
260 | - if ('' === $prefix || !preg_match('//u', $prefix)) { |
|
261 | - return false; |
|
262 | - } |
|
263 | - |
|
264 | - if ($this->ignoreCase) { |
|
265 | - return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8'); |
|
266 | - } |
|
267 | - |
|
268 | - return 0 === strncmp($this->string, $prefix, \strlen($prefix)); |
|
269 | - } |
|
27 | + public function __construct(string $string = '') |
|
28 | + { |
|
29 | + if ('' !== $string && !preg_match('//u', $string)) { |
|
30 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
31 | + } |
|
32 | + |
|
33 | + $this->string = $string; |
|
34 | + } |
|
35 | + |
|
36 | + public function append(string ...$suffix): AbstractString |
|
37 | + { |
|
38 | + $str = clone $this; |
|
39 | + $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix); |
|
40 | + |
|
41 | + if (!preg_match('//u', $str->string)) { |
|
42 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
43 | + } |
|
44 | + |
|
45 | + return $str; |
|
46 | + } |
|
47 | + |
|
48 | + public function chunk(int $length = 1): array |
|
49 | + { |
|
50 | + if (1 > $length) { |
|
51 | + throw new InvalidArgumentException('The chunk length must be greater than zero.'); |
|
52 | + } |
|
53 | + |
|
54 | + if ('' === $this->string) { |
|
55 | + return []; |
|
56 | + } |
|
57 | + |
|
58 | + $rx = '/('; |
|
59 | + while (65535 < $length) { |
|
60 | + $rx .= '.{65535}'; |
|
61 | + $length -= 65535; |
|
62 | + } |
|
63 | + $rx .= '.{'.$length.'})/us'; |
|
64 | + |
|
65 | + $str = clone $this; |
|
66 | + $chunks = []; |
|
67 | + |
|
68 | + foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) { |
|
69 | + $str->string = $chunk; |
|
70 | + $chunks[] = clone $str; |
|
71 | + } |
|
72 | + |
|
73 | + return $chunks; |
|
74 | + } |
|
75 | + |
|
76 | + public function codePointsAt(int $offset): array |
|
77 | + { |
|
78 | + $str = $offset ? $this->slice($offset, 1) : $this; |
|
79 | + |
|
80 | + return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')]; |
|
81 | + } |
|
82 | + |
|
83 | + public function endsWith($suffix): bool |
|
84 | + { |
|
85 | + if ($suffix instanceof AbstractString) { |
|
86 | + $suffix = $suffix->string; |
|
87 | + } elseif (\is_array($suffix) || $suffix instanceof \Traversable) { |
|
88 | + return parent::endsWith($suffix); |
|
89 | + } else { |
|
90 | + $suffix = (string) $suffix; |
|
91 | + } |
|
92 | + |
|
93 | + if ('' === $suffix || !preg_match('//u', $suffix)) { |
|
94 | + return false; |
|
95 | + } |
|
96 | + |
|
97 | + if ($this->ignoreCase) { |
|
98 | + return preg_match('{'.preg_quote($suffix).'$}iuD', $this->string); |
|
99 | + } |
|
100 | + |
|
101 | + return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix)); |
|
102 | + } |
|
103 | + |
|
104 | + public function equalsTo($string): bool |
|
105 | + { |
|
106 | + if ($string instanceof AbstractString) { |
|
107 | + $string = $string->string; |
|
108 | + } elseif (\is_array($string) || $string instanceof \Traversable) { |
|
109 | + return parent::equalsTo($string); |
|
110 | + } else { |
|
111 | + $string = (string) $string; |
|
112 | + } |
|
113 | + |
|
114 | + if ('' !== $string && $this->ignoreCase) { |
|
115 | + return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8'); |
|
116 | + } |
|
117 | + |
|
118 | + return $string === $this->string; |
|
119 | + } |
|
120 | + |
|
121 | + public function indexOf($needle, int $offset = 0): ?int |
|
122 | + { |
|
123 | + if ($needle instanceof AbstractString) { |
|
124 | + $needle = $needle->string; |
|
125 | + } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
126 | + return parent::indexOf($needle, $offset); |
|
127 | + } else { |
|
128 | + $needle = (string) $needle; |
|
129 | + } |
|
130 | + |
|
131 | + if ('' === $needle) { |
|
132 | + return null; |
|
133 | + } |
|
134 | + |
|
135 | + $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8'); |
|
136 | + |
|
137 | + return false === $i ? null : $i; |
|
138 | + } |
|
139 | + |
|
140 | + public function indexOfLast($needle, int $offset = 0): ?int |
|
141 | + { |
|
142 | + if ($needle instanceof AbstractString) { |
|
143 | + $needle = $needle->string; |
|
144 | + } elseif (\is_array($needle) || $needle instanceof \Traversable) { |
|
145 | + return parent::indexOfLast($needle, $offset); |
|
146 | + } else { |
|
147 | + $needle = (string) $needle; |
|
148 | + } |
|
149 | + |
|
150 | + if ('' === $needle) { |
|
151 | + return null; |
|
152 | + } |
|
153 | + |
|
154 | + $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8'); |
|
155 | + |
|
156 | + return false === $i ? null : $i; |
|
157 | + } |
|
158 | + |
|
159 | + public function length(): int |
|
160 | + { |
|
161 | + return mb_strlen($this->string, 'UTF-8'); |
|
162 | + } |
|
163 | + |
|
164 | + public function prepend(string ...$prefix): AbstractString |
|
165 | + { |
|
166 | + $str = clone $this; |
|
167 | + $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string; |
|
168 | + |
|
169 | + if (!preg_match('//u', $str->string)) { |
|
170 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
171 | + } |
|
172 | + |
|
173 | + return $str; |
|
174 | + } |
|
175 | + |
|
176 | + public function replace(string $from, string $to): AbstractString |
|
177 | + { |
|
178 | + $str = clone $this; |
|
179 | + |
|
180 | + if ('' === $from || !preg_match('//u', $from)) { |
|
181 | + return $str; |
|
182 | + } |
|
183 | + |
|
184 | + if ('' !== $to && !preg_match('//u', $to)) { |
|
185 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
186 | + } |
|
187 | + |
|
188 | + if ($this->ignoreCase) { |
|
189 | + $str->string = implode($to, preg_split('{'.preg_quote($from).'}iuD', $this->string)); |
|
190 | + } else { |
|
191 | + $str->string = str_replace($from, $to, $this->string); |
|
192 | + } |
|
193 | + |
|
194 | + return $str; |
|
195 | + } |
|
196 | + |
|
197 | + public function slice(int $start = 0, int $length = null): AbstractString |
|
198 | + { |
|
199 | + $str = clone $this; |
|
200 | + $str->string = mb_substr($this->string, $start, $length, 'UTF-8'); |
|
201 | + |
|
202 | + return $str; |
|
203 | + } |
|
204 | + |
|
205 | + public function splice(string $replacement, int $start = 0, int $length = null): AbstractString |
|
206 | + { |
|
207 | + if (!preg_match('//u', $replacement)) { |
|
208 | + throw new InvalidArgumentException('Invalid UTF-8 string.'); |
|
209 | + } |
|
210 | + |
|
211 | + $str = clone $this; |
|
212 | + $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0; |
|
213 | + $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length; |
|
214 | + $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX); |
|
215 | + |
|
216 | + return $str; |
|
217 | + } |
|
218 | + |
|
219 | + public function split(string $delimiter, int $limit = null, int $flags = null): array |
|
220 | + { |
|
221 | + if (1 > $limit = $limit ?? \PHP_INT_MAX) { |
|
222 | + throw new InvalidArgumentException('Split limit must be a positive integer.'); |
|
223 | + } |
|
224 | + |
|
225 | + if ('' === $delimiter) { |
|
226 | + throw new InvalidArgumentException('Split delimiter is empty.'); |
|
227 | + } |
|
228 | + |
|
229 | + if (null !== $flags) { |
|
230 | + return parent::split($delimiter.'u', $limit, $flags); |
|
231 | + } |
|
232 | + |
|
233 | + if (!preg_match('//u', $delimiter)) { |
|
234 | + throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.'); |
|
235 | + } |
|
236 | + |
|
237 | + $str = clone $this; |
|
238 | + $chunks = $this->ignoreCase |
|
239 | + ? preg_split('{'.preg_quote($delimiter).'}iuD', $this->string, $limit) |
|
240 | + : explode($delimiter, $this->string, $limit); |
|
241 | + |
|
242 | + foreach ($chunks as &$chunk) { |
|
243 | + $str->string = $chunk; |
|
244 | + $chunk = clone $str; |
|
245 | + } |
|
246 | + |
|
247 | + return $chunks; |
|
248 | + } |
|
249 | + |
|
250 | + public function startsWith($prefix): bool |
|
251 | + { |
|
252 | + if ($prefix instanceof AbstractString) { |
|
253 | + $prefix = $prefix->string; |
|
254 | + } elseif (\is_array($prefix) || $prefix instanceof \Traversable) { |
|
255 | + return parent::startsWith($prefix); |
|
256 | + } else { |
|
257 | + $prefix = (string) $prefix; |
|
258 | + } |
|
259 | + |
|
260 | + if ('' === $prefix || !preg_match('//u', $prefix)) { |
|
261 | + return false; |
|
262 | + } |
|
263 | + |
|
264 | + if ($this->ignoreCase) { |
|
265 | + return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8'); |
|
266 | + } |
|
267 | + |
|
268 | + return 0 === strncmp($this->string, $prefix, \strlen($prefix)); |
|
269 | + } |
|
270 | 270 | } |