@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @internal |
33 | 33 | */ |
34 | -final class Grapheme |
|
35 | -{ |
|
34 | +final class Grapheme { |
|
36 | 35 | // (CRLF|([ZWNJ-ZWJ]|T+|L*(LV?V+|LV|LVT)T*|L+|[^Control])[Extend]*|[Control]) |
37 | 36 | // This regular expression is a work around for http://bugs.exim.org/1279 |
38 | 37 | public const GRAPHEME_CLUSTER_RX = '(?:\r\n|(?:[ -~\x{200C}\x{200D}]|[ᆨ-ᇹ]+|[ᄀ-ᅟ]*(?:[가개갸걔거게겨계고과괘괴교구궈궤귀규그긔기까깨꺄꺠꺼께껴꼐꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨끄끠끼나내냐냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴느늬니다대댜댸더데뎌뎨도돠돼되됴두둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴또똬뙈뙤뚀뚜뚸뛔뛰뜌뜨띄띠라래랴럐러레려례로롸뢔뢰료루뤄뤠뤼류르릐리마매먀먜머메며몌모뫄뫠뫼묘무뭐뭬뮈뮤므믜미바배뱌뱨버베벼볘보봐봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴뻐뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼쁘쁴삐사새샤섀서세셔셰소솨쇄쇠쇼수숴쉐쉬슈스싀시싸쌔쌰썌써쎄쎠쎼쏘쏴쐐쐬쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어에여예오와왜외요우워웨위유으의이자재쟈쟤저제져졔조좌좨죄죠주줘줴쥐쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴쬐쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체쳐쳬초촤쵀최쵸추춰췌취츄츠츼치카캐캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴큐크킈키타태탸턔터테텨톄토톼퇘퇴툐투퉈퉤튀튜트틔티파패퍄퍠퍼페펴폐포퐈퐤푀표푸풔풰퓌퓨프픠피하해햐햬허헤혀혜호화홰회효후훠훼휘휴흐희히]?[ᅠ-ᆢ]+|[가-힣])[ᆨ-ᇹ]*|[ᄀ-ᅟ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])'; |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
43 | 42 | ]; |
44 | 43 | |
45 | - public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0) |
|
46 | - { |
|
44 | + public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0) { |
|
47 | 45 | if (0 > $start) { |
48 | 46 | $start = \strlen($s) + $start; |
49 | 47 | } |
@@ -111,15 +109,13 @@ discard block |
||
111 | 109 | return $ret; |
112 | 110 | } |
113 | 111 | |
114 | - public static function grapheme_strlen($s) |
|
115 | - { |
|
112 | + public static function grapheme_strlen($s) { |
|
116 | 113 | preg_replace('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', '', $s, -1, $len); |
117 | 114 | |
118 | 115 | return 0 === $len && '' !== $s ? null : $len; |
119 | 116 | } |
120 | 117 | |
121 | - public static function grapheme_substr($s, $start, $len = null) |
|
122 | - { |
|
118 | + public static function grapheme_substr($s, $start, $len = null) { |
|
123 | 119 | if (null === $len) { |
124 | 120 | $len = 2147483647; |
125 | 121 | } |
@@ -161,38 +157,31 @@ discard block |
||
161 | 157 | return implode('', \array_slice($s[0], $start, $len)); |
162 | 158 | } |
163 | 159 | |
164 | - public static function grapheme_strpos($s, $needle, $offset = 0) |
|
165 | - { |
|
160 | + public static function grapheme_strpos($s, $needle, $offset = 0) { |
|
166 | 161 | return self::grapheme_position($s, $needle, $offset, 0); |
167 | 162 | } |
168 | 163 | |
169 | - public static function grapheme_stripos($s, $needle, $offset = 0) |
|
170 | - { |
|
164 | + public static function grapheme_stripos($s, $needle, $offset = 0) { |
|
171 | 165 | return self::grapheme_position($s, $needle, $offset, 1); |
172 | 166 | } |
173 | 167 | |
174 | - public static function grapheme_strrpos($s, $needle, $offset = 0) |
|
175 | - { |
|
168 | + public static function grapheme_strrpos($s, $needle, $offset = 0) { |
|
176 | 169 | return self::grapheme_position($s, $needle, $offset, 2); |
177 | 170 | } |
178 | 171 | |
179 | - public static function grapheme_strripos($s, $needle, $offset = 0) |
|
180 | - { |
|
172 | + public static function grapheme_strripos($s, $needle, $offset = 0) { |
|
181 | 173 | return self::grapheme_position($s, $needle, $offset, 3); |
182 | 174 | } |
183 | 175 | |
184 | - public static function grapheme_stristr($s, $needle, $beforeNeedle = false) |
|
185 | - { |
|
176 | + public static function grapheme_stristr($s, $needle, $beforeNeedle = false) { |
|
186 | 177 | return mb_stristr($s, $needle, $beforeNeedle, 'UTF-8'); |
187 | 178 | } |
188 | 179 | |
189 | - public static function grapheme_strstr($s, $needle, $beforeNeedle = false) |
|
190 | - { |
|
180 | + public static function grapheme_strstr($s, $needle, $beforeNeedle = false) { |
|
191 | 181 | return mb_strstr($s, $needle, $beforeNeedle, 'UTF-8'); |
192 | 182 | } |
193 | 183 | |
194 | - private static function grapheme_position($s, $needle, $offset, $mode) |
|
195 | - { |
|
184 | + private static function grapheme_position($s, $needle, $offset, $mode) { |
|
196 | 185 | $needle = (string) $needle; |
197 | 186 | if (80000 > \PHP_VERSION_ID && !preg_match('/./us', $needle)) { |
198 | 187 | return false; |
@@ -26,8 +26,7 @@ |
||
26 | 26 | * |
27 | 27 | * @author Nicolas Grekas <[email protected]> |
28 | 28 | */ |
29 | -interface ServiceSubscriberInterface |
|
30 | -{ |
|
29 | +interface ServiceSubscriberInterface { |
|
31 | 30 | /** |
32 | 31 | * Returns an array of service types required by such instances, optionally keyed by the service names used internally. |
33 | 32 | * |
@@ -20,6 +20,5 @@ |
||
20 | 20 | * @author Alexander M. Turek <[email protected]> |
21 | 21 | */ |
22 | 22 | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] |
23 | -final class Required |
|
24 | -{ |
|
23 | +final class Required { |
|
25 | 24 | } |
@@ -19,8 +19,7 @@ |
||
19 | 19 | * @author Nicolas Grekas <[email protected]> |
20 | 20 | * @author Mateusz Sip <[email protected]> |
21 | 21 | */ |
22 | -interface ServiceProviderInterface extends ContainerInterface |
|
23 | -{ |
|
22 | +interface ServiceProviderInterface extends ContainerInterface { |
|
24 | 23 | /** |
25 | 24 | * Returns an associative array of service types keyed by the identifiers provided by the current container. |
26 | 25 | * |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * @author Robin Chalas <[email protected]> |
25 | 25 | * @author Nicolas Grekas <[email protected]> |
26 | 26 | */ |
27 | -trait ServiceLocatorTrait |
|
28 | -{ |
|
27 | +trait ServiceLocatorTrait { |
|
29 | 28 | private $factories; |
30 | 29 | private $loading = []; |
31 | 30 | private $providedTypes; |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | /** |
34 | 33 | * @param callable[] $factories |
35 | 34 | */ |
36 | - public function __construct(array $factories) |
|
37 | - { |
|
35 | + public function __construct(array $factories) { |
|
38 | 36 | $this->factories = $factories; |
39 | 37 | } |
40 | 38 | |
@@ -43,8 +41,7 @@ discard block |
||
43 | 41 | * |
44 | 42 | * @return bool |
45 | 43 | */ |
46 | - public function has(string $id) |
|
47 | - { |
|
44 | + public function has(string $id) { |
|
48 | 45 | return isset($this->factories[$id]); |
49 | 46 | } |
50 | 47 | |
@@ -53,8 +50,7 @@ discard block |
||
53 | 50 | * |
54 | 51 | * @return mixed |
55 | 52 | */ |
56 | - public function get(string $id) |
|
57 | - { |
|
53 | + public function get(string $id) { |
|
58 | 54 | if (!isset($this->factories[$id])) { |
59 | 55 | throw $this->createNotFoundException($id); |
60 | 56 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @author Kevin Bond <[email protected]> |
21 | 21 | */ |
22 | -trait ServiceSubscriberTrait |
|
23 | -{ |
|
22 | +trait ServiceSubscriberTrait { |
|
24 | 23 | /** @var ContainerInterface */ |
25 | 24 | protected $container; |
26 | 25 | |
@@ -53,8 +52,7 @@ discard block |
||
53 | 52 | /** |
54 | 53 | * @required |
55 | 54 | */ |
56 | - public function setContainer(ContainerInterface $container) |
|
57 | - { |
|
55 | + public function setContainer(ContainerInterface $container) { |
|
58 | 56 | $this->container = $container; |
59 | 57 | |
60 | 58 | if (\is_callable(['parent', __FUNCTION__])) { |
@@ -24,7 +24,6 @@ |
||
24 | 24 | * process loop (note that we advise making your services stateless instead of |
25 | 25 | * implementing this interface when possible.) |
26 | 26 | */ |
27 | -interface ResetInterface |
|
28 | -{ |
|
27 | +interface ResetInterface { |
|
29 | 28 | public function reset(); |
30 | 29 | } |
@@ -15,17 +15,14 @@ discard block |
||
15 | 15 | use Psr\Container\ContainerInterface; |
16 | 16 | use Symfony\Contracts\Service\ServiceLocatorTrait; |
17 | 17 | |
18 | -abstract class ServiceLocatorTest extends TestCase |
|
19 | -{ |
|
20 | - protected function getServiceLocator(array $factories) |
|
21 | - { |
|
18 | +abstract class ServiceLocatorTest extends TestCase { |
|
19 | + protected function getServiceLocator(array $factories) { |
|
22 | 20 | return new class($factories) implements ContainerInterface { |
23 | 21 | use ServiceLocatorTrait; |
24 | 22 | }; |
25 | 23 | } |
26 | 24 | |
27 | - public function testHas() |
|
28 | - { |
|
25 | + public function testHas() { |
|
29 | 26 | $locator = $this->getServiceLocator([ |
30 | 27 | 'foo' => function () { return 'bar'; }, |
31 | 28 | 'bar' => function () { return 'baz'; }, |
@@ -37,8 +34,7 @@ discard block |
||
37 | 34 | $this->assertFalse($locator->has('dummy')); |
38 | 35 | } |
39 | 36 | |
40 | - public function testGet() |
|
41 | - { |
|
37 | + public function testGet() { |
|
42 | 38 | $locator = $this->getServiceLocator([ |
43 | 39 | 'foo' => function () { return 'bar'; }, |
44 | 40 | 'bar' => function () { return 'baz'; }, |
@@ -48,8 +44,7 @@ discard block |
||
48 | 44 | $this->assertSame('baz', $locator->get('bar')); |
49 | 45 | } |
50 | 46 | |
51 | - public function testGetDoesNotMemoize() |
|
52 | - { |
|
47 | + public function testGetDoesNotMemoize() { |
|
53 | 48 | $i = 0; |
54 | 49 | $locator = $this->getServiceLocator([ |
55 | 50 | 'foo' => function () use (&$i) { |
@@ -64,8 +59,7 @@ discard block |
||
64 | 59 | $this->assertSame(2, $i); |
65 | 60 | } |
66 | 61 | |
67 | - public function testThrowsOnUndefinedInternalService() |
|
68 | - { |
|
62 | + public function testThrowsOnUndefinedInternalService() { |
|
69 | 63 | if (!$this->getExpectedException()) { |
70 | 64 | $this->expectException(\Psr\Container\NotFoundExceptionInterface::class); |
71 | 65 | $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.'); |
@@ -77,8 +71,7 @@ discard block |
||
77 | 71 | $locator->get('foo'); |
78 | 72 | } |
79 | 73 | |
80 | - public function testThrowsOnCircularReference() |
|
81 | - { |
|
74 | + public function testThrowsOnCircularReference() { |
|
82 | 75 | $this->expectException(\Psr\Container\ContainerExceptionInterface::class); |
83 | 76 | $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".'); |
84 | 77 | $locator = $this->getServiceLocator([ |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @internal |
67 | 67 | */ |
68 | -final class Mbstring |
|
69 | -{ |
|
68 | +final class Mbstring { |
|
70 | 69 | public const MB_CASE_FOLD = \PHP_INT_MAX; |
71 | 70 | |
72 | 71 | private const CASE_FOLD = [ |
@@ -78,8 +77,7 @@ discard block |
||
78 | 77 | private static $language = 'neutral'; |
79 | 78 | private static $internalEncoding = 'UTF-8'; |
80 | 79 | |
81 | - public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) |
|
82 | - { |
|
80 | + public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) { |
|
83 | 81 | if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) { |
84 | 82 | $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); |
85 | 83 | } else { |
@@ -116,8 +114,7 @@ discard block |
||
116 | 114 | return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s); |
117 | 115 | } |
118 | 116 | |
119 | - public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) |
|
120 | - { |
|
117 | + public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) { |
|
121 | 118 | $ok = true; |
122 | 119 | array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { |
123 | 120 | if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { |
@@ -128,18 +125,15 @@ discard block |
||
128 | 125 | return $ok ? $fromEncoding : false; |
129 | 126 | } |
130 | 127 | |
131 | - public static function mb_decode_mimeheader($s) |
|
132 | - { |
|
128 | + public static function mb_decode_mimeheader($s) { |
|
133 | 129 | return \iconv_mime_decode($s, 2, self::$internalEncoding); |
134 | 130 | } |
135 | 131 | |
136 | - public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) |
|
137 | - { |
|
132 | + public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) { |
|
138 | 133 | trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING); |
139 | 134 | } |
140 | 135 | |
141 | - public static function mb_decode_numericentity($s, $convmap, $encoding = null) |
|
142 | - { |
|
136 | + public static function mb_decode_numericentity($s, $convmap, $encoding = null) { |
|
143 | 137 | if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { |
144 | 138 | trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
145 | 139 | |
@@ -198,8 +192,7 @@ discard block |
||
198 | 192 | return \iconv('UTF-8', $encoding.'//IGNORE', $s); |
199 | 193 | } |
200 | 194 | |
201 | - public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) |
|
202 | - { |
|
195 | + public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) { |
|
203 | 196 | if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { |
204 | 197 | trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
205 | 198 | |
@@ -268,8 +261,7 @@ discard block |
||
268 | 261 | return \iconv('UTF-8', $encoding.'//IGNORE', $result); |
269 | 262 | } |
270 | 263 | |
271 | - public static function mb_convert_case($s, $mode, $encoding = null) |
|
272 | - { |
|
264 | + public static function mb_convert_case($s, $mode, $encoding = null) { |
|
273 | 265 | $s = (string) $s; |
274 | 266 | if ('' === $s) { |
275 | 267 | return ''; |
@@ -346,8 +338,7 @@ discard block |
||
346 | 338 | return \iconv('UTF-8', $encoding.'//IGNORE', $s); |
347 | 339 | } |
348 | 340 | |
349 | - public static function mb_internal_encoding($encoding = null) |
|
350 | - { |
|
341 | + public static function mb_internal_encoding($encoding = null) { |
|
351 | 342 | if (null === $encoding) { |
352 | 343 | return self::$internalEncoding; |
353 | 344 | } |
@@ -367,8 +358,7 @@ discard block |
||
367 | 358 | throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding)); |
368 | 359 | } |
369 | 360 | |
370 | - public static function mb_language($lang = null) |
|
371 | - { |
|
361 | + public static function mb_language($lang = null) { |
|
372 | 362 | if (null === $lang) { |
373 | 363 | return self::$language; |
374 | 364 | } |
@@ -388,13 +378,11 @@ discard block |
||
388 | 378 | throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang)); |
389 | 379 | } |
390 | 380 | |
391 | - public static function mb_list_encodings() |
|
392 | - { |
|
381 | + public static function mb_list_encodings() { |
|
393 | 382 | return ['UTF-8']; |
394 | 383 | } |
395 | 384 | |
396 | - public static function mb_encoding_aliases($encoding) |
|
397 | - { |
|
385 | + public static function mb_encoding_aliases($encoding) { |
|
398 | 386 | switch (strtoupper($encoding)) { |
399 | 387 | case 'UTF8': |
400 | 388 | case 'UTF-8': |
@@ -404,8 +392,7 @@ discard block |
||
404 | 392 | return false; |
405 | 393 | } |
406 | 394 | |
407 | - public static function mb_check_encoding($var = null, $encoding = null) |
|
408 | - { |
|
395 | + public static function mb_check_encoding($var = null, $encoding = null) { |
|
409 | 396 | if (null === $encoding) { |
410 | 397 | if (null === $var) { |
411 | 398 | return false; |
@@ -416,8 +403,7 @@ discard block |
||
416 | 403 | return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var); |
417 | 404 | } |
418 | 405 | |
419 | - public static function mb_detect_encoding($str, $encodingList = null, $strict = false) |
|
420 | - { |
|
406 | + public static function mb_detect_encoding($str, $encodingList = null, $strict = false) { |
|
421 | 407 | if (null === $encodingList) { |
422 | 408 | $encodingList = self::$encodingList; |
423 | 409 | } else { |
@@ -452,8 +438,7 @@ discard block |
||
452 | 438 | return false; |
453 | 439 | } |
454 | 440 | |
455 | - public static function mb_detect_order($encodingList = null) |
|
456 | - { |
|
441 | + public static function mb_detect_order($encodingList = null) { |
|
457 | 442 | if (null === $encodingList) { |
458 | 443 | return self::$encodingList; |
459 | 444 | } |
@@ -481,8 +466,7 @@ discard block |
||
481 | 466 | return true; |
482 | 467 | } |
483 | 468 | |
484 | - public static function mb_strlen($s, $encoding = null) |
|
485 | - { |
|
469 | + public static function mb_strlen($s, $encoding = null) { |
|
486 | 470 | $encoding = self::getEncoding($encoding); |
487 | 471 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
488 | 472 | return \strlen($s); |
@@ -491,8 +475,7 @@ discard block |
||
491 | 475 | return @\iconv_strlen($s, $encoding); |
492 | 476 | } |
493 | 477 | |
494 | - public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) |
|
495 | - { |
|
478 | + public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { |
|
496 | 479 | $encoding = self::getEncoding($encoding); |
497 | 480 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
498 | 481 | return strpos($haystack, $needle, $offset); |
@@ -512,8 +495,7 @@ discard block |
||
512 | 495 | return \iconv_strpos($haystack, $needle, $offset, $encoding); |
513 | 496 | } |
514 | 497 | |
515 | - public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) |
|
516 | - { |
|
498 | + public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { |
|
517 | 499 | $encoding = self::getEncoding($encoding); |
518 | 500 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
519 | 501 | return strrpos($haystack, $needle, $offset); |
@@ -539,8 +521,7 @@ discard block |
||
539 | 521 | return false !== $pos ? $offset + $pos : false; |
540 | 522 | } |
541 | 523 | |
542 | - public static function mb_str_split($string, $split_length = 1, $encoding = null) |
|
543 | - { |
|
524 | + public static function mb_str_split($string, $split_length = 1, $encoding = null) { |
|
544 | 525 | if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { |
545 | 526 | trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); |
546 | 527 | |
@@ -581,18 +562,15 @@ discard block |
||
581 | 562 | return $result; |
582 | 563 | } |
583 | 564 | |
584 | - public static function mb_strtolower($s, $encoding = null) |
|
585 | - { |
|
565 | + public static function mb_strtolower($s, $encoding = null) { |
|
586 | 566 | return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding); |
587 | 567 | } |
588 | 568 | |
589 | - public static function mb_strtoupper($s, $encoding = null) |
|
590 | - { |
|
569 | + public static function mb_strtoupper($s, $encoding = null) { |
|
591 | 570 | return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding); |
592 | 571 | } |
593 | 572 | |
594 | - public static function mb_substitute_character($c = null) |
|
595 | - { |
|
573 | + public static function mb_substitute_character($c = null) { |
|
596 | 574 | if (null === $c) { |
597 | 575 | return 'none'; |
598 | 576 | } |
@@ -606,8 +584,7 @@ discard block |
||
606 | 584 | throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint'); |
607 | 585 | } |
608 | 586 | |
609 | - public static function mb_substr($s, $start, $length = null, $encoding = null) |
|
610 | - { |
|
587 | + public static function mb_substr($s, $start, $length = null, $encoding = null) { |
|
611 | 588 | $encoding = self::getEncoding($encoding); |
612 | 589 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
613 | 590 | return (string) substr($s, $start, null === $length ? 2147483647 : $length); |
@@ -632,23 +609,20 @@ discard block |
||
632 | 609 | return (string) \iconv_substr($s, $start, $length, $encoding); |
633 | 610 | } |
634 | 611 | |
635 | - public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) |
|
636 | - { |
|
612 | + public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { |
|
637 | 613 | $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); |
638 | 614 | $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); |
639 | 615 | |
640 | 616 | return self::mb_strpos($haystack, $needle, $offset, $encoding); |
641 | 617 | } |
642 | 618 | |
643 | - public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) |
|
644 | - { |
|
619 | + public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) { |
|
645 | 620 | $pos = self::mb_stripos($haystack, $needle, 0, $encoding); |
646 | 621 | |
647 | 622 | return self::getSubpart($pos, $part, $haystack, $encoding); |
648 | 623 | } |
649 | 624 | |
650 | - public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) |
|
651 | - { |
|
625 | + public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) { |
|
652 | 626 | $encoding = self::getEncoding($encoding); |
653 | 627 | if ('CP850' === $encoding || 'ASCII' === $encoding) { |
654 | 628 | $pos = strrpos($haystack, $needle); |
@@ -660,24 +634,21 @@ discard block |
||
660 | 634 | return self::getSubpart($pos, $part, $haystack, $encoding); |
661 | 635 | } |
662 | 636 | |
663 | - public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) |
|
664 | - { |
|
637 | + public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) { |
|
665 | 638 | $needle = self::mb_substr($needle, 0, 1, $encoding); |
666 | 639 | $pos = self::mb_strripos($haystack, $needle, $encoding); |
667 | 640 | |
668 | 641 | return self::getSubpart($pos, $part, $haystack, $encoding); |
669 | 642 | } |
670 | 643 | |
671 | - public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) |
|
672 | - { |
|
644 | + public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { |
|
673 | 645 | $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); |
674 | 646 | $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); |
675 | 647 | |
676 | 648 | return self::mb_strrpos($haystack, $needle, $offset, $encoding); |
677 | 649 | } |
678 | 650 | |
679 | - public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) |
|
680 | - { |
|
651 | + public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) { |
|
681 | 652 | $pos = strpos($haystack, $needle); |
682 | 653 | if (false === $pos) { |
683 | 654 | return false; |
@@ -689,8 +660,7 @@ discard block |
||
689 | 660 | return substr($haystack, $pos); |
690 | 661 | } |
691 | 662 | |
692 | - public static function mb_get_info($type = 'all') |
|
693 | - { |
|
663 | + public static function mb_get_info($type = 'all') { |
|
694 | 664 | $info = [ |
695 | 665 | 'internal_encoding' => self::$internalEncoding, |
696 | 666 | 'http_output' => 'pass', |
@@ -718,18 +688,15 @@ discard block |
||
718 | 688 | return false; |
719 | 689 | } |
720 | 690 | |
721 | - public static function mb_http_input($type = '') |
|
722 | - { |
|
691 | + public static function mb_http_input($type = '') { |
|
723 | 692 | return false; |
724 | 693 | } |
725 | 694 | |
726 | - public static function mb_http_output($encoding = null) |
|
727 | - { |
|
695 | + public static function mb_http_output($encoding = null) { |
|
728 | 696 | return null !== $encoding ? 'pass' === $encoding : 'pass'; |
729 | 697 | } |
730 | 698 | |
731 | - public static function mb_strwidth($s, $encoding = null) |
|
732 | - { |
|
699 | + public static function mb_strwidth($s, $encoding = null) { |
|
733 | 700 | $encoding = self::getEncoding($encoding); |
734 | 701 | |
735 | 702 | if ('UTF-8' !== $encoding) { |
@@ -741,18 +708,15 @@ discard block |
||
741 | 708 | return ($wide << 1) + \iconv_strlen($s, 'UTF-8'); |
742 | 709 | } |
743 | 710 | |
744 | - public static function mb_substr_count($haystack, $needle, $encoding = null) |
|
745 | - { |
|
711 | + public static function mb_substr_count($haystack, $needle, $encoding = null) { |
|
746 | 712 | return substr_count($haystack, $needle); |
747 | 713 | } |
748 | 714 | |
749 | - public static function mb_output_handler($contents, $status) |
|
750 | - { |
|
715 | + public static function mb_output_handler($contents, $status) { |
|
751 | 716 | return $contents; |
752 | 717 | } |
753 | 718 | |
754 | - public static function mb_chr($code, $encoding = null) |
|
755 | - { |
|
719 | + public static function mb_chr($code, $encoding = null) { |
|
756 | 720 | if (0x80 > $code %= 0x200000) { |
757 | 721 | $s = \chr($code); |
758 | 722 | } elseif (0x800 > $code) { |
@@ -770,8 +734,7 @@ discard block |
||
770 | 734 | return $s; |
771 | 735 | } |
772 | 736 | |
773 | - public static function mb_ord($s, $encoding = null) |
|
774 | - { |
|
737 | + public static function mb_ord($s, $encoding = null) { |
|
775 | 738 | if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { |
776 | 739 | $s = mb_convert_encoding($s, 'UTF-8', $encoding); |
777 | 740 | } |
@@ -794,8 +757,7 @@ discard block |
||
794 | 757 | return $code; |
795 | 758 | } |
796 | 759 | |
797 | - private static function getSubpart($pos, $part, $haystack, $encoding) |
|
798 | - { |
|
760 | + private static function getSubpart($pos, $part, $haystack, $encoding) { |
|
799 | 761 | if (false === $pos) { |
800 | 762 | return false; |
801 | 763 | } |
@@ -806,8 +768,7 @@ discard block |
||
806 | 768 | return self::mb_substr($haystack, $pos, null, $encoding); |
807 | 769 | } |
808 | 770 | |
809 | - private static function html_encoding_callback(array $m) |
|
810 | - { |
|
771 | + private static function html_encoding_callback(array $m) { |
|
811 | 772 | $i = 1; |
812 | 773 | $entities = ''; |
813 | 774 | $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8')); |
@@ -831,13 +792,11 @@ discard block |
||
831 | 792 | return $entities; |
832 | 793 | } |
833 | 794 | |
834 | - private static function title_case(array $s) |
|
835 | - { |
|
795 | + private static function title_case(array $s) { |
|
836 | 796 | return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
837 | 797 | } |
838 | 798 | |
839 | - private static function getData($file) |
|
840 | - { |
|
799 | + private static function getData($file) { |
|
841 | 800 | if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
842 | 801 | return require $file; |
843 | 802 | } |
@@ -845,8 +804,7 @@ discard block |
||
845 | 804 | return false; |
846 | 805 | } |
847 | 806 | |
848 | - private static function getEncoding($encoding) |
|
849 | - { |
|
807 | + private static function getEncoding($encoding) { |
|
850 | 808 | if (null === $encoding) { |
851 | 809 | return self::$internalEncoding; |
852 | 810 | } |