@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare (strict_types=1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | namespace Wordlift\Modules\Plugin_Diagnostics\Psr\Container; |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | $s = \html_entity_decode($s, \ENT_COMPAT, 'UTF-8'); |
| 100 | 100 | $fromEncoding = 'UTF-8'; |
| 101 | 101 | } |
| 102 | - return \iconv($fromEncoding, $toEncoding . '//IGNORE', $s); |
|
| 102 | + return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s); |
|
| 103 | 103 | } |
| 104 | 104 | public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) |
| 105 | 105 | { |
| 106 | 106 | $ok = \true; |
| 107 | - \array_walk_recursive($vars, function (&$v) use(&$ok, $toEncoding, $fromEncoding) { |
|
| 107 | + \array_walk_recursive($vars, function(&$v) use(&$ok, $toEncoding, $fromEncoding) { |
|
| 108 | 108 | if (\false === ($v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding))) { |
| 109 | 109 | $ok = \false; |
| 110 | 110 | } |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | public static function mb_decode_numericentity($s, $convmap, $encoding = null) |
| 123 | 123 | { |
| 124 | - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { |
|
| 125 | - \trigger_error('mb_decode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
| 124 | + if (null !== $s && ! \is_scalar($s) && ! (\is_object($s) && \method_exists($s, '__toString'))) { |
|
| 125 | + \trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
| 126 | 126 | return null; |
| 127 | 127 | } |
| 128 | - if (!\is_array($convmap) || 80000 > \PHP_VERSION_ID && !$convmap) { |
|
| 128 | + if ( ! \is_array($convmap) || 80000 > \PHP_VERSION_ID && ! $convmap) { |
|
| 129 | 129 | return \false; |
| 130 | 130 | } |
| 131 | - if (null !== $encoding && !\is_scalar($encoding)) { |
|
| 132 | - \trigger_error('mb_decode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
| 131 | + if (null !== $encoding && ! \is_scalar($encoding)) { |
|
| 132 | + \trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
| 133 | 133 | return ''; |
| 134 | 134 | // Instead of null (cf. mb_encode_numericentity). |
| 135 | 135 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $encoding = self::getEncoding($encoding); |
| 141 | 141 | if ('UTF-8' === $encoding) { |
| 142 | 142 | $encoding = null; |
| 143 | - if (!\preg_match('//u', $s)) { |
|
| 143 | + if ( ! \preg_match('//u', $s)) { |
|
| 144 | 144 | $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); |
| 145 | 145 | } |
| 146 | 146 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $convmap[$i] += $convmap[$i + 2]; |
| 153 | 153 | $convmap[$i + 1] += $convmap[$i + 2]; |
| 154 | 154 | } |
| 155 | - $s = \preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use($cnt, $convmap) { |
|
| 155 | + $s = \preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function(array $m) use($cnt, $convmap) { |
|
| 156 | 156 | $c = isset($m[2]) ? (int) \hexdec($m[2]) : $m[1]; |
| 157 | 157 | for ($i = 0; $i < $cnt; $i += 4) { |
| 158 | 158 | if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { |
@@ -164,24 +164,24 @@ discard block |
||
| 164 | 164 | if (null === $encoding) { |
| 165 | 165 | return $s; |
| 166 | 166 | } |
| 167 | - return \iconv('UTF-8', $encoding . '//IGNORE', $s); |
|
| 167 | + return \iconv('UTF-8', $encoding.'//IGNORE', $s); |
|
| 168 | 168 | } |
| 169 | 169 | public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = \false) |
| 170 | 170 | { |
| 171 | - if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { |
|
| 172 | - \trigger_error('mb_encode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
| 171 | + if (null !== $s && ! \is_scalar($s) && ! (\is_object($s) && \method_exists($s, '__toString'))) { |
|
| 172 | + \trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | - if (!\is_array($convmap) || 80000 > \PHP_VERSION_ID && !$convmap) { |
|
| 175 | + if ( ! \is_array($convmap) || 80000 > \PHP_VERSION_ID && ! $convmap) { |
|
| 176 | 176 | return \false; |
| 177 | 177 | } |
| 178 | - if (null !== $encoding && !\is_scalar($encoding)) { |
|
| 179 | - \trigger_error('mb_encode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
| 178 | + if (null !== $encoding && ! \is_scalar($encoding)) { |
|
| 179 | + \trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
| 180 | 180 | return null; |
| 181 | 181 | // Instead of '' (cf. mb_decode_numericentity). |
| 182 | 182 | } |
| 183 | - if (null !== $is_hex && !\is_scalar($is_hex)) { |
|
| 184 | - \trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
| 183 | + if (null !== $is_hex && ! \is_scalar($is_hex)) { |
|
| 184 | + \trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); |
|
| 185 | 185 | return null; |
| 186 | 186 | } |
| 187 | 187 | $s = (string) $s; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $encoding = self::getEncoding($encoding); |
| 192 | 192 | if ('UTF-8' === $encoding) { |
| 193 | 193 | $encoding = null; |
| 194 | - if (!\preg_match('//u', $s)) { |
|
| 194 | + if ( ! \preg_match('//u', $s)) { |
|
| 195 | 195 | $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); |
| 196 | 196 | } |
| 197 | 197 | } else { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | for ($j = 0; $j < $cnt; $j += 4) { |
| 211 | 211 | if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { |
| 212 | 212 | $cOffset = $c + $convmap[$j + 2] & $convmap[$j + 3]; |
| 213 | - $result .= $is_hex ? \sprintf('&#x%X;', $cOffset) : '&#' . $cOffset . ';'; |
|
| 213 | + $result .= $is_hex ? \sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; |
|
| 214 | 214 | continue 2; |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if (null === $encoding) { |
| 220 | 220 | return $result; |
| 221 | 221 | } |
| 222 | - return \iconv('UTF-8', $encoding . '//IGNORE', $result); |
|
| 222 | + return \iconv('UTF-8', $encoding.'//IGNORE', $result); |
|
| 223 | 223 | } |
| 224 | 224 | public static function mb_convert_case($s, $mode, $encoding = null) |
| 225 | 225 | { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $encoding = self::getEncoding($encoding); |
| 231 | 231 | if ('UTF-8' === $encoding) { |
| 232 | 232 | $encoding = null; |
| 233 | - if (!\preg_match('//u', $s)) { |
|
| 233 | + if ( ! \preg_match('//u', $s)) { |
|
| 234 | 234 | $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); |
| 235 | 235 | } |
| 236 | 236 | } else { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | if (null === $encoding) { |
| 290 | 290 | return $s; |
| 291 | 291 | } |
| 292 | - return \iconv('UTF-8', $encoding . '//IGNORE', $s); |
|
| 292 | + return \iconv('UTF-8', $encoding.'//IGNORE', $s); |
|
| 293 | 293 | } |
| 294 | 294 | public static function mb_internal_encoding($encoding = null) |
| 295 | 295 | { |
@@ -347,14 +347,14 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | $encoding = self::$internalEncoding; |
| 349 | 349 | } |
| 350 | - if (!\is_array($var)) { |
|
| 350 | + if ( ! \is_array($var)) { |
|
| 351 | 351 | return self::mb_detect_encoding($var, [$encoding]) || \false !== @\iconv($encoding, $encoding, $var); |
| 352 | 352 | } |
| 353 | 353 | foreach ($var as $key => $value) { |
| 354 | - if (!self::mb_check_encoding($key, $encoding)) { |
|
| 354 | + if ( ! self::mb_check_encoding($key, $encoding)) { |
|
| 355 | 355 | return \false; |
| 356 | 356 | } |
| 357 | - if (!self::mb_check_encoding($value, $encoding)) { |
|
| 357 | + if ( ! self::mb_check_encoding($value, $encoding)) { |
|
| 358 | 358 | return \false; |
| 359 | 359 | } |
| 360 | 360 | } |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | if (null === $encodingList) { |
| 366 | 366 | $encodingList = self::$encodingList; |
| 367 | 367 | } else { |
| 368 | - if (!\is_array($encodingList)) { |
|
| 368 | + if ( ! \is_array($encodingList)) { |
|
| 369 | 369 | $encodingList = \array_map('trim', \explode(',', $encodingList)); |
| 370 | 370 | } |
| 371 | 371 | $encodingList = \array_map('strtoupper', $encodingList); |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | foreach ($encodingList as $enc) { |
| 374 | 374 | switch ($enc) { |
| 375 | 375 | case 'ASCII': |
| 376 | - if (!\preg_match('/[\\x80-\\xFF]/', $str)) { |
|
| 376 | + if ( ! \preg_match('/[\\x80-\\xFF]/', $str)) { |
|
| 377 | 377 | return $enc; |
| 378 | 378 | } |
| 379 | 379 | break; |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | if (null === $encodingList) { |
| 397 | 397 | return self::$encodingList; |
| 398 | 398 | } |
| 399 | - if (!\is_array($encodingList)) { |
|
| 399 | + if ( ! \is_array($encodingList)) { |
|
| 400 | 400 | $encodingList = \array_map('trim', \explode(',', $encodingList)); |
| 401 | 401 | } |
| 402 | 402 | $encodingList = \array_map('strtoupper', $encodingList); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $needle = (string) $needle; |
| 433 | 433 | if ('' === $needle) { |
| 434 | 434 | if (80000 > \PHP_VERSION_ID) { |
| 435 | - \trigger_error(__METHOD__ . ': Empty delimiter', \E_USER_WARNING); |
|
| 435 | + \trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); |
|
| 436 | 436 | return \false; |
| 437 | 437 | } |
| 438 | 438 | return 0; |
@@ -462,8 +462,8 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | public static function mb_str_split($string, $split_length = 1, $encoding = null) |
| 464 | 464 | { |
| 465 | - if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) { |
|
| 466 | - \trigger_error('mb_str_split() expects parameter 1 to be string, ' . \gettype($string) . ' given', \E_USER_WARNING); |
|
| 465 | + if (null !== $string && ! \is_scalar($string) && ! (\is_object($string) && \method_exists($string, '__toString'))) { |
|
| 466 | + \trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); |
|
| 467 | 467 | return null; |
| 468 | 468 | } |
| 469 | 469 | if (1 > ($split_length = (int) $split_length)) { |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | $rx .= '.{65535}'; |
| 483 | 483 | $split_length -= 65535; |
| 484 | 484 | } |
| 485 | - $rx .= '.{' . $split_length . '})/us'; |
|
| 485 | + $rx .= '.{'.$split_length.'})/us'; |
|
| 486 | 486 | return \preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); |
| 487 | 487 | } |
| 488 | 488 | $result = []; |
@@ -625,11 +625,11 @@ discard block |
||
| 625 | 625 | if (0x80 > ($code %= 0x200000)) { |
| 626 | 626 | $s = \chr($code); |
| 627 | 627 | } elseif (0x800 > $code) { |
| 628 | - $s = \chr(0xc0 | $code >> 6) . \chr(0x80 | $code & 0x3f); |
|
| 628 | + $s = \chr(0xc0 | $code >> 6).\chr(0x80 | $code & 0x3f); |
|
| 629 | 629 | } elseif (0x10000 > $code) { |
| 630 | - $s = \chr(0xe0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f); |
|
| 630 | + $s = \chr(0xe0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3f).\chr(0x80 | $code & 0x3f); |
|
| 631 | 631 | } else { |
| 632 | - $s = \chr(0xf0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3f) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f); |
|
| 632 | + $s = \chr(0xf0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3f).\chr(0x80 | $code >> 6 & 0x3f).\chr(0x80 | $code & 0x3f); |
|
| 633 | 633 | } |
| 634 | 634 | if ('UTF-8' !== ($encoding = self::getEncoding($encoding))) { |
| 635 | 635 | $s = \mb_convert_encoding($s, $encoding, 'UTF-8'); |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | } |
| 659 | 659 | public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, string $encoding = null) : string |
| 660 | 660 | { |
| 661 | - if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], \true)) { |
|
| 661 | + if ( ! \in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], \true)) { |
|
| 662 | 662 | throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); |
| 663 | 663 | } |
| 664 | 664 | if (null === $encoding) { |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | throw new \ValueError(\sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); |
| 671 | 671 | } |
| 672 | 672 | // BC for PHP 7.3 and lower |
| 673 | - if (!$validEncoding) { |
|
| 673 | + if ( ! $validEncoding) { |
|
| 674 | 674 | throw new \ValueError(\sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); |
| 675 | 675 | } |
| 676 | 676 | if (self::mb_strlen($pad_string, $encoding) <= 0) { |
@@ -682,13 +682,13 @@ discard block |
||
| 682 | 682 | } |
| 683 | 683 | switch ($pad_type) { |
| 684 | 684 | case \STR_PAD_LEFT: |
| 685 | - return self::mb_substr(\str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding) . $string; |
|
| 685 | + return self::mb_substr(\str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; |
|
| 686 | 686 | case \STR_PAD_RIGHT: |
| 687 | - return $string . self::mb_substr(\str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); |
|
| 687 | + return $string.self::mb_substr(\str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); |
|
| 688 | 688 | default: |
| 689 | 689 | $leftPaddingLength = \floor($paddingRequired / 2); |
| 690 | 690 | $rightPaddingLength = $paddingRequired - $leftPaddingLength; |
| 691 | - return self::mb_substr(\str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding) . $string . self::mb_substr(\str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); |
|
| 691 | + return self::mb_substr(\str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(\str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); |
|
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | private static function getSubpart($pos, $part, $haystack, $encoding) |
@@ -718,17 +718,17 @@ discard block |
||
| 718 | 718 | } else { |
| 719 | 719 | $c = ($m[$i++] - 0xc0 << 6) + $m[$i++] - 0x80; |
| 720 | 720 | } |
| 721 | - $entities .= '&#' . $c . ';'; |
|
| 721 | + $entities .= '&#'.$c.';'; |
|
| 722 | 722 | } |
| 723 | 723 | return $entities; |
| 724 | 724 | } |
| 725 | 725 | private static function title_case(array $s) |
| 726 | 726 | { |
| 727 | - return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8') . self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
|
| 727 | + return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
|
| 728 | 728 | } |
| 729 | 729 | private static function getData($file) |
| 730 | 730 | { |
| 731 | - if (\file_exists($file = __DIR__ . '/Resources/unidata/' . $file . '.php')) { |
|
| 731 | + if (\file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
| 732 | 732 | return require $file; |
| 733 | 733 | } |
| 734 | 734 | return \false; |
@@ -14,21 +14,21 @@ discard block |
||
| 14 | 14 | if (\PHP_VERSION_ID >= 70300) { |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | -if (!\function_exists('is_countable')) { |
|
| 17 | +if ( ! \function_exists('is_countable')) { |
|
| 18 | 18 | function is_countable($value) |
| 19 | 19 | { |
| 20 | 20 | return \is_array($value) || $value instanceof \Countable || $value instanceof \ResourceBundle || $value instanceof \SimpleXmlElement; |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | -if (!\function_exists('hrtime')) { |
|
| 24 | - require_once __DIR__ . '/Php73.php'; |
|
| 23 | +if ( ! \function_exists('hrtime')) { |
|
| 24 | + require_once __DIR__.'/Php73.php'; |
|
| 25 | 25 | p\Php73::$startAt = (int) \microtime(\true); |
| 26 | 26 | function hrtime($as_number = \false) |
| 27 | 27 | { |
| 28 | 28 | return p\Php73::hrtime($as_number); |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | -if (!\function_exists('array_key_first')) { |
|
| 31 | +if ( ! \function_exists('array_key_first')) { |
|
| 32 | 32 | function array_key_first(array $array) |
| 33 | 33 | { |
| 34 | 34 | foreach ($array as $key => $value) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | -if (!\function_exists('array_key_last')) { |
|
| 39 | +if ( ! \function_exists('array_key_last')) { |
|
| 40 | 40 | function array_key_last(array $array) |
| 41 | 41 | { |
| 42 | 42 | return \key(\array_slice($array, -1, 1, \true)); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | if (\is_string($resource) && \strlen($resource) !== ($i = \strcspn($resource, '*?{['))) { |
| 68 | 68 | $ret = []; |
| 69 | 69 | $isSubpath = 0 !== $i && \false !== \strpos(\substr($resource, 0, $i), '/'); |
| 70 | - foreach ($this->glob($resource, \false, $_, $ignoreErrors || !$isSubpath) as $path => $info) { |
|
| 70 | + foreach ($this->glob($resource, \false, $_, $ignoreErrors || ! $isSubpath) as $path => $info) { |
|
| 71 | 71 | if (null !== ($res = $this->doImport($path, 'glob' === $type ? null : $type, $ignoreErrors, $sourceResource))) { |
| 72 | 72 | $ret[] = $res; |
| 73 | 73 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $pattern = ''; |
| 90 | 90 | } elseif (0 === $i || \false === \strpos(\substr($pattern, 0, $i), '/')) { |
| 91 | 91 | $prefix = '.'; |
| 92 | - $pattern = '/' . $pattern; |
|
| 92 | + $pattern = '/'.$pattern; |
|
| 93 | 93 | } else { |
| 94 | 94 | $prefix = \dirname(\substr($pattern, 0, 1 + $i)); |
| 95 | 95 | $pattern = \substr($pattern, \strlen($prefix)); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | try { |
| 98 | 98 | $prefix = $this->locator->locate($prefix, $this->currentDir, \true); |
| 99 | 99 | } catch (FileLocatorFileNotFoundException $e) { |
| 100 | - if (!$ignoreErrors) { |
|
| 100 | + if ( ! $ignoreErrors) { |
|
| 101 | 101 | throw $e; |
| 102 | 102 | } |
| 103 | 103 | $resource = []; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } catch (FileLoaderImportCircularReferenceException $e) { |
| 140 | 140 | throw $e; |
| 141 | 141 | } catch (\Exception $e) { |
| 142 | - if (!$ignoreErrors) { |
|
| 142 | + if ( ! $ignoreErrors) { |
|
| 143 | 143 | // prevent embedded imports from nesting multiple exceptions |
| 144 | 144 | if ($e instanceof FileLoaderLoadException) { |
| 145 | 145 | throw $e; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function parse($content, $schemaOrCallable = null) |
| 45 | 45 | { |
| 46 | - if (!\extension_loaded('dom')) { |
|
| 46 | + if ( ! \extension_loaded('dom')) { |
|
| 47 | 47 | throw new \RuntimeException('Extension DOM is required.'); |
| 48 | 48 | } |
| 49 | 49 | $internalErrors = \libxml_use_internal_errors(\true); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | \libxml_clear_errors(); |
| 54 | 54 | $dom = new \DOMDocument(); |
| 55 | 55 | $dom->validateOnParse = \true; |
| 56 | - if (!$dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { |
|
| 56 | + if ( ! $dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { |
|
| 57 | 57 | if (\LIBXML_VERSION < 20900) { |
| 58 | 58 | \libxml_disable_entity_loader($disableEntities); |
| 59 | 59 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | } catch (\Exception $e) { |
| 80 | 80 | $valid = \false; |
| 81 | 81 | } |
| 82 | - } elseif (!\is_array($schemaOrCallable) && \is_file((string) $schemaOrCallable)) { |
|
| 82 | + } elseif ( ! \is_array($schemaOrCallable) && \is_file((string) $schemaOrCallable)) { |
|
| 83 | 83 | $schemaSource = \file_get_contents((string) $schemaOrCallable); |
| 84 | 84 | $valid = @$dom->schemaValidateSource($schemaSource); |
| 85 | 85 | } else { |
| 86 | 86 | \libxml_use_internal_errors($internalErrors); |
| 87 | 87 | throw new XmlParsingException('The schemaOrCallable argument has to be a valid path to XSD file or callable.'); |
| 88 | 88 | } |
| 89 | - if (!$valid) { |
|
| 89 | + if ( ! $valid) { |
|
| 90 | 90 | $messages = static::getXmlErrors($internalErrors); |
| 91 | 91 | if (empty($messages)) { |
| 92 | 92 | throw new InvalidXmlException('The XML is not valid.', 0, $e); |
@@ -112,10 +112,10 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public static function loadFile($file, $schemaOrCallable = null) |
| 114 | 114 | { |
| 115 | - if (!\is_file($file)) { |
|
| 115 | + if ( ! \is_file($file)) { |
|
| 116 | 116 | throw new \InvalidArgumentException(\sprintf('Resource "%s" is not a file.', $file)); |
| 117 | 117 | } |
| 118 | - if (!\is_readable($file)) { |
|
| 118 | + if ( ! \is_readable($file)) { |
|
| 119 | 119 | throw new \InvalidArgumentException(\sprintf('File "%s" is not readable.', $file)); |
| 120 | 120 | } |
| 121 | 121 | $content = @\file_get_contents($file); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $empty = \true; |
| 155 | 155 | $config = []; |
| 156 | 156 | foreach ($element->attributes as $name => $node) { |
| 157 | - if ($checkPrefix && !\in_array((string) $node->prefix, ['', $prefix], \true)) { |
|
| 157 | + if ($checkPrefix && ! \in_array((string) $node->prefix, ['', $prefix], \true)) { |
|
| 158 | 158 | continue; |
| 159 | 159 | } |
| 160 | 160 | $config[$name] = static::phpize($node->value); |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | } elseif ($checkPrefix && $prefix != (string) $node->prefix) { |
| 171 | 171 | continue; |
| 172 | - } elseif (!$node instanceof \DOMComment) { |
|
| 172 | + } elseif ( ! $node instanceof \DOMComment) { |
|
| 173 | 173 | $value = static::convertDomElementToArray($node, $checkPrefix); |
| 174 | 174 | $key = $node->localName; |
| 175 | 175 | if (isset($config[$key])) { |
| 176 | - if (!\is_array($config[$key]) || !\is_int(\key($config[$key]))) { |
|
| 176 | + if ( ! \is_array($config[$key]) || ! \is_int(\key($config[$key]))) { |
|
| 177 | 177 | $config[$key] = [$config[$key]]; |
| 178 | 178 | } |
| 179 | 179 | $config[$key][] = $value; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $config = $value; |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | - return !$empty ? $config : null; |
|
| 194 | + return ! $empty ? $config : null; |
|
| 195 | 195 | } |
| 196 | 196 | /** |
| 197 | 197 | * Converts an xml value to a PHP type. |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | return \true; |
| 220 | 220 | case 'false' === $lowercaseValue: |
| 221 | 221 | return \false; |
| 222 | - case isset($value[1]) && '0b' == $value[0] . $value[1] && \preg_match('/^0b[01]*$/', $value): |
|
| 222 | + case isset($value[1]) && '0b' == $value[0].$value[1] && \preg_match('/^0b[01]*$/', $value): |
|
| 223 | 223 | return \bindec($value); |
| 224 | 224 | case \is_numeric($value): |
| 225 | - return '0x' === $value[0] . $value[1] ? \hexdec($value) : (float) $value; |
|
| 225 | + return '0x' === $value[0].$value[1] ? \hexdec($value) : (float) $value; |
|
| 226 | 226 | case \preg_match('/^0x[0-9a-f]++$/i', $value): |
| 227 | 227 | return \hexdec($value); |
| 228 | 228 | case \preg_match('/^[+-]?[0-9]+(\\.[0-9]+)?$/', $value): |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | // Trim the trailing period of the previous message. We only want 1 period remove so no rtrim... |
| 33 | 33 | if ('.' === \substr($previous->getMessage(), -1)) { |
| 34 | 34 | $trimmedMessage = \substr($previous->getMessage(), 0, -1); |
| 35 | - $message .= \sprintf('%s', $trimmedMessage) . ' in '; |
|
| 35 | + $message .= \sprintf('%s', $trimmedMessage).' in '; |
|
| 36 | 36 | } else { |
| 37 | - $message .= \sprintf('%s', $previous->getMessage()) . ' in '; |
|
| 37 | + $message .= \sprintf('%s', $previous->getMessage()).' in '; |
|
| 38 | 38 | } |
| 39 | - $message .= $resource . ' '; |
|
| 39 | + $message .= $resource.' '; |
|
| 40 | 40 | // show tweaked trace to complete the human readable sentence |
| 41 | 41 | if (null === $sourceResource) { |
| 42 | 42 | $message .= \sprintf('(which is loaded in resource "%s")', $this->varToString($resource)); |
@@ -58,18 +58,18 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function isFresh() |
| 60 | 60 | { |
| 61 | - if (!\is_file($this->file)) { |
|
| 61 | + if ( ! \is_file($this->file)) { |
|
| 62 | 62 | return \false; |
| 63 | 63 | } |
| 64 | - if ($this->resourceCheckers instanceof \Traversable && !$this->resourceCheckers instanceof \Countable) { |
|
| 64 | + if ($this->resourceCheckers instanceof \Traversable && ! $this->resourceCheckers instanceof \Countable) { |
|
| 65 | 65 | $this->resourceCheckers = \iterator_to_array($this->resourceCheckers); |
| 66 | 66 | } |
| 67 | - if (!\count($this->resourceCheckers)) { |
|
| 67 | + if ( ! \count($this->resourceCheckers)) { |
|
| 68 | 68 | return \true; |
| 69 | 69 | // shortcut - if we don't have any checkers we don't need to bother with the meta file at all |
| 70 | 70 | } |
| 71 | 71 | $metadata = $this->getMetaFile(); |
| 72 | - if (!\is_file($metadata)) { |
|
| 72 | + if ( ! \is_file($metadata)) { |
|
| 73 | 73 | return \false; |
| 74 | 74 | } |
| 75 | 75 | $meta = $this->safelyUnserialize($metadata); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | foreach ($meta as $resource) { |
| 81 | 81 | /* @var ResourceInterface $resource */ |
| 82 | 82 | foreach ($this->resourceCheckers as $checker) { |
| 83 | - if (!$checker->supports($resource)) { |
|
| 83 | + if ( ! $checker->supports($resource)) { |
|
| 84 | 84 | continue; |
| 85 | 85 | // next checker |
| 86 | 86 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function getMetaFile() |
| 135 | 135 | { |
| 136 | - return $this->file . '.meta'; |
|
| 136 | + return $this->file.'.meta'; |
|
| 137 | 137 | } |
| 138 | 138 | private function safelyUnserialize($file) |
| 139 | 139 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $content = \file_get_contents($file); |
| 143 | 143 | $signalingException = new \UnexpectedValueException(); |
| 144 | 144 | $prevUnserializeHandler = \ini_set('unserialize_callback_func', ''); |
| 145 | - $prevErrorHandler = \set_error_handler(function ($type, $msg, $file, $line, $context = []) use(&$prevErrorHandler, $signalingException) { |
|
| 145 | + $prevErrorHandler = \set_error_handler(function($type, $msg, $file, $line, $context = []) use(&$prevErrorHandler, $signalingException) { |
|
| 146 | 146 | if (__FILE__ === $file) { |
| 147 | 147 | throw $signalingException; |
| 148 | 148 | } |
@@ -34,11 +34,11 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function cache($file, $callback) |
| 36 | 36 | { |
| 37 | - if (!\is_callable($callback)) { |
|
| 37 | + if ( ! \is_callable($callback)) { |
|
| 38 | 38 | throw new \InvalidArgumentException(\sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); |
| 39 | 39 | } |
| 40 | 40 | $cache = new ConfigCache($file, $this->debug); |
| 41 | - if (!$cache->isFresh()) { |
|
| 41 | + if ( ! $cache->isFresh()) { |
|
| 42 | 42 | \call_user_func($callback, $cache); |
| 43 | 43 | } |
| 44 | 44 | return $cache; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function isFresh() |
| 49 | 49 | { |
| 50 | - if (!$this->debug && \is_file($this->getPath())) { |
|
| 50 | + if ( ! $this->debug && \is_file($this->getPath())) { |
|
| 51 | 51 | return \true; |
| 52 | 52 | } |
| 53 | 53 | return parent::isFresh(); |