PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.89
WindPress – Tailwind CSS integration for WordPress v3.2.89
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
← All changes | vendor/symfony/string/CodePointString.php +46 -46 3.0.33.2.89 View file →
@@ -7,12 +7,12 @@
7 7 *
8 8 * For the full copyright and license information, please view the LICENSE
9 9 * file that was distributed with this source code.
10 10 */
11 -namespace WindPressPackages\Symfony\Component\String;
11 +namespace WindPressDeps\Symfony\Component\String;
12 12
13 -use WindPressPackages\Symfony\Component\String\Exception\ExceptionInterface;
14 -use WindPressPackages\Symfony\Component\String\Exception\InvalidArgumentException;
13 +use WindPressDeps\Symfony\Component\String\Exception\ExceptionInterface;
14 +use WindPressDeps\Symfony\Component\String\Exception\InvalidArgumentException;
15 15 /**
16 16 * Represents a string of Unicode code points encoded as UTF-8.
17 17 *
18 18 * @author Nicolas Grekas <p@tchwork.com>
@@ -23,23 +23,23 @@
23 23 class CodePointString extends AbstractUnicodeString
24 24 {
25 25 public function __construct(string $string = '')
26 26 {
27 - if ('' !== $string && !\preg_match('//u', $string)) {
27 + if ('' !== $string && !preg_match('//u', $string)) {
28 28 throw new InvalidArgumentException('Invalid UTF-8 string.');
29 29 }
30 30 $this->string = $string;
31 31 }
32 - public function append(string ...$suffix) : AbstractString
32 + public function append(string ...$suffix): AbstractString
33 33 {
34 34 $str = clone $this;
35 - $str->string .= 1 >= \count($suffix) ? $suffix[0] ?? '' : \implode('', $suffix);
36 - if (!\preg_match('//u', $str->string)) {
35 + $str->string .= 1 >= \count($suffix) ? $suffix[0] ?? '' : implode('', $suffix);
36 + if (!preg_match('//u', $str->string)) {
37 37 throw new InvalidArgumentException('Invalid UTF-8 string.');
38 38 }
39 39 return $str;
40 40 }
41 - public function chunk(int $length = 1) : array
41 + public function chunk(int $length = 1): array
42 42 {
43 43 if (1 > $length) {
44 44 throw new InvalidArgumentException('The chunk length must be greater than zero.');
45 45 }
@@ -53,20 +53,20 @@
53 53 }
54 54 $rx .= '.{' . $length . '})/us';
55 55 $str = clone $this;
56 56 $chunks = [];
57 - foreach (\preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
57 + foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
58 58 $str->string = $chunk;
59 59 $chunks[] = clone $str;
60 60 }
61 61 return $chunks;
62 62 }
63 - public function codePointsAt(int $offset) : array
63 + public function codePointsAt(int $offset): array
64 64 {
65 65 $str = $offset ? $this->slice($offset, 1) : $this;
66 - return '' === $str->string ? [] : [\mb_ord($str->string, 'UTF-8')];
66 + return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')];
67 67 }
68 - public function endsWith($suffix) : bool
68 + public function endsWith($suffix): bool
69 69 {
70 70 if ($suffix instanceof AbstractString) {
71 71 $suffix = $suffix->string;
72 72 } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
@@ -73,17 +73,17 @@
73 73 return parent::endsWith($suffix);
74 74 } else {
75 75 $suffix = (string) $suffix;
76 76 }
77 - if ('' === $suffix || !\preg_match('//u', $suffix)) {
77 + if ('' === $suffix || !preg_match('//u', $suffix)) {
78 78 return \false;
79 79 }
80 80 if ($this->ignoreCase) {
81 - return \preg_match('{' . \preg_quote($suffix) . '$}iuD', $this->string);
81 + return preg_match('{' . preg_quote($suffix) . '$}iuD', $this->string);
82 82 }
83 - return \strlen($this->string) >= \strlen($suffix) && 0 === \substr_compare($this->string, $suffix, -\strlen($suffix));
83 + return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix));
84 84 }
85 - public function equalsTo($string) : bool
85 + public function equalsTo($string): bool
86 86 {
87 87 if ($string instanceof AbstractString) {
88 88 $string = $string->string;
89 89 } elseif (\is_array($string) || $string instanceof \Traversable) {
@@ -91,13 +91,13 @@
91 91 } else {
92 92 $string = (string) $string;
93 93 }
94 94 if ('' !== $string && $this->ignoreCase) {
95 - return \strlen($string) === \strlen($this->string) && 0 === \mb_stripos($this->string, $string, 0, 'UTF-8');
95 + return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
96 96 }
97 97 return $string === $this->string;
98 98 }
99 - public function indexOf($needle, int $offset = 0) : ?int
99 + public function indexOf($needle, int $offset = 0): ?int
100 100 {
101 101 if ($needle instanceof AbstractString) {
102 102 $needle = $needle->string;
103 103 } elseif (\is_array($needle) || $needle instanceof \Traversable) {
@@ -107,12 +107,12 @@
107 107 }
108 108 if ('' === $needle) {
109 109 return null;
110 110 }
111 - $i = $this->ignoreCase ? \mb_stripos($this->string, $needle, $offset, 'UTF-8') : \mb_strpos($this->string, $needle, $offset, 'UTF-8');
111 + $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8');
112 112 return \false === $i ? null : $i;
113 113 }
114 - public function indexOfLast($needle, int $offset = 0) : ?int
114 + public function indexOfLast($needle, int $offset = 0): ?int
115 115 {
116 116 if ($needle instanceof AbstractString) {
117 117 $needle = $needle->string;
118 118 } elseif (\is_array($needle) || $needle instanceof \Traversable) {
@@ -122,60 +122,60 @@
122 122 }
123 123 if ('' === $needle) {
124 124 return null;
125 125 }
126 - $i = $this->ignoreCase ? \mb_strripos($this->string, $needle, $offset, 'UTF-8') : \mb_strrpos($this->string, $needle, $offset, 'UTF-8');
126 + $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8');
127 127 return \false === $i ? null : $i;
128 128 }
129 - public function length() : int
129 + public function length(): int
130 130 {
131 - return \mb_strlen($this->string, 'UTF-8');
131 + return mb_strlen($this->string, 'UTF-8');
132 132 }
133 - public function prepend(string ...$prefix) : AbstractString
133 + public function prepend(string ...$prefix): AbstractString
134 134 {
135 135 $str = clone $this;
136 - $str->string = (1 >= \count($prefix) ? $prefix[0] ?? '' : \implode('', $prefix)) . $this->string;
137 - if (!\preg_match('//u', $str->string)) {
136 + $str->string = (1 >= \count($prefix) ? $prefix[0] ?? '' : implode('', $prefix)) . $this->string;
137 + if (!preg_match('//u', $str->string)) {
138 138 throw new InvalidArgumentException('Invalid UTF-8 string.');
139 139 }
140 140 return $str;
141 141 }
142 - public function replace(string $from, string $to) : AbstractString
142 + public function replace(string $from, string $to): AbstractString
143 143 {
144 144 $str = clone $this;
145 - if ('' === $from || !\preg_match('//u', $from)) {
145 + if ('' === $from || !preg_match('//u', $from)) {
146 146 return $str;
147 147 }
148 - if ('' !== $to && !\preg_match('//u', $to)) {
148 + if ('' !== $to && !preg_match('//u', $to)) {
149 149 throw new InvalidArgumentException('Invalid UTF-8 string.');
150 150 }
151 151 if ($this->ignoreCase) {
152 - $str->string = \implode($to, \preg_split('{' . \preg_quote($from) . '}iuD', $this->string));
152 + $str->string = implode($to, preg_split('{' . preg_quote($from) . '}iuD', $this->string));
153 153 } else {
154 - $str->string = \str_replace($from, $to, $this->string);
154 + $str->string = str_replace($from, $to, $this->string);
155 155 }
156 156 return $str;
157 157 }
158 - public function slice(int $start = 0, ?int $length = null) : AbstractString
158 + public function slice(int $start = 0, ?int $length = null): AbstractString
159 159 {
160 160 $str = clone $this;
161 - $str->string = \mb_substr($this->string, $start, $length, 'UTF-8');
161 + $str->string = mb_substr($this->string, $start, $length, 'UTF-8');
162 162 return $str;
163 163 }
164 - public function splice(string $replacement, int $start = 0, ?int $length = null) : AbstractString
164 + public function splice(string $replacement, int $start = 0, ?int $length = null): AbstractString
165 165 {
166 - if (!\preg_match('//u', $replacement)) {
166 + if (!preg_match('//u', $replacement)) {
167 167 throw new InvalidArgumentException('Invalid UTF-8 string.');
168 168 }
169 169 $str = clone $this;
170 - $start = $start ? \strlen(\mb_substr($this->string, 0, $start, 'UTF-8')) : 0;
171 - $length = $length ? \strlen(\mb_substr($this->string, $start, $length, 'UTF-8')) : $length;
172 - $str->string = \substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
170 + $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0;
171 + $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length;
172 + $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
173 173 return $str;
174 174 }
175 - public function split(string $delimiter, ?int $limit = null, ?int $flags = null) : array
175 + public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
176 176 {
177 - if (1 > ($limit = $limit ?? \PHP_INT_MAX)) {
177 + if (1 > $limit = $limit ?? \PHP_INT_MAX) {
178 178 throw new InvalidArgumentException('Split limit must be a positive integer.');
179 179 }
180 180 if ('' === $delimiter) {
181 181 throw new InvalidArgumentException('Split delimiter is empty.');
@@ -182,13 +182,13 @@
182 182 }
183 183 if (null !== $flags) {
184 184 return parent::split($delimiter . 'u', $limit, $flags);
185 185 }
186 - if (!\preg_match('//u', $delimiter)) {
186 + if (!preg_match('//u', $delimiter)) {
187 187 throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
188 188 }
189 189 $str = clone $this;
190 - $chunks = $this->ignoreCase ? \preg_split('{' . \preg_quote($delimiter) . '}iuD', $this->string, $limit) : \explode($delimiter, $this->string, $limit);
190 + $chunks = $this->ignoreCase ? preg_split('{' . preg_quote($delimiter) . '}iuD', $this->string, $limit) : explode($delimiter, $this->string, $limit);
191 191 foreach ($chunks as &$chunk) {
192 192 $str->string = $chunk;
193 193 $chunk = clone $str;
194 194 }
@@ -193,9 +193,9 @@
193 193 $chunk = clone $str;
194 194 }
195 195 return $chunks;
196 196 }
197 - public function startsWith($prefix) : bool
197 + public function startsWith($prefix): bool
198 198 {
199 199 if ($prefix instanceof AbstractString) {
200 200 $prefix = $prefix->string;
201 201 } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
@@ -202,13 +202,13 @@
202 202 return parent::startsWith($prefix);
203 203 } else {
204 204 $prefix = (string) $prefix;
205 205 }
206 - if ('' === $prefix || !\preg_match('//u', $prefix)) {
206 + if ('' === $prefix || !preg_match('//u', $prefix)) {
207 207 return \false;
208 208 }
209 209 if ($this->ignoreCase) {
210 - return 0 === \mb_stripos($this->string, $prefix, 0, 'UTF-8');
210 + return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8');
211 211 }
212 - return 0 === \strncmp($this->string, $prefix, \strlen($prefix));
212 + return 0 === strncmp($this->string, $prefix, \strlen($prefix));
213 213 }
214 214 }