| @@ -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 grapheme clusters encoded as UTF-8. |
| 17 | 17 | * |
| 18 | 18 | * A letter followed by combining characters (accents typically) form what Unicode defines |
| @@ -39,9 +39,9 @@ | ||
| 39 | 39 | } |
| 40 | 40 | public function append(string ...$suffix): AbstractString |
| 41 | 41 | { |
| 42 | 42 | $str = clone $this; |
| 43 | - $str->string = $this->string . ((1 >= \count($suffix)) ? $suffix[0] ?? '' : implode('', $suffix)); | |
| 43 | + $str->string = $this->string . (1 >= \count($suffix) ? $suffix[0] ?? '' : implode('', $suffix)); | |
| 44 | 44 | normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
| 45 | 45 | if (\false === $str->string) { |
| 46 | 46 | throw new InvalidArgumentException('Invalid UTF-8 string.'); |
| 47 | 47 | } |
| @@ -77,9 +77,9 @@ | ||
| 77 | 77 | return parent::endsWith($suffix); |
| 78 | 78 | } else { |
| 79 | 79 | $suffix = (string) $suffix; |
| 80 | 80 | } |
| 81 | - $form = (null === $this->ignoreCase) ? \Normalizer::NFD : \Normalizer::NFC; | |
| 81 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; | |
| 82 | 82 | normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form); |
| 83 | 83 | if ('' === $suffix || \false === $suffix) { |
| 84 | 84 | return \false; |
| 85 | 85 | } |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | return parent::equalsTo($string); |
| 97 | 97 | } else { |
| 98 | 98 | $string = (string) $string; |
| 99 | 99 | } |
| 100 | - $form = (null === $this->ignoreCase) ? \Normalizer::NFD : \Normalizer::NFC; | |
| 100 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; | |
| 101 | 101 | normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form); |
| 102 | 102 | if ('' !== $string && \false !== $string && $this->ignoreCase) { |
| 103 | 103 | return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8'); |
| 104 | 104 | } |
| @@ -112,9 +112,9 @@ | ||
| 112 | 112 | return parent::indexOf($needle, $offset); |
| 113 | 113 | } else { |
| 114 | 114 | $needle = (string) $needle; |
| 115 | 115 | } |
| 116 | - $form = (null === $this->ignoreCase) ? \Normalizer::NFD : \Normalizer::NFC; | |
| 116 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; | |
| 117 | 117 | normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form); |
| 118 | 118 | if ('' === $needle || \false === $needle) { |
| 119 | 119 | return null; |
| 120 | 120 | } |
| @@ -122,9 +122,9 @@ | ||
| 122 | 122 | $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset); |
| 123 | 123 | } catch (\ValueError $e) { |
| 124 | 124 | return null; |
| 125 | 125 | } |
| 126 | - return (\false === $i) ? null : $i; | |
| 126 | + return \false === $i ? null : $i; | |
| 127 | 127 | } |
| 128 | 128 | public function indexOfLast($needle, int $offset = 0): ?int |
| 129 | 129 | { |
| 130 | 130 | if ($needle instanceof AbstractString) { |
| @@ -133,9 +133,9 @@ | ||
| 133 | 133 | return parent::indexOfLast($needle, $offset); |
| 134 | 134 | } else { |
| 135 | 135 | $needle = (string) $needle; |
| 136 | 136 | } |
| 137 | - $form = (null === $this->ignoreCase) ? \Normalizer::NFD : \Normalizer::NFC; | |
| 137 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; | |
| 138 | 138 | normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form); |
| 139 | 139 | if ('' === $needle || \false === $needle) { |
| 140 | 140 | return null; |
| 141 | 141 | } |
| @@ -147,9 +147,9 @@ | ||
| 147 | 147 | } |
| 148 | 148 | $offset = 0; |
| 149 | 149 | } |
| 150 | 150 | $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset); |
| 151 | - return (\false === $i) ? null : $i; | |
| 151 | + return \false === $i ? null : $i; | |
| 152 | 152 | } |
| 153 | 153 | public function join(array $strings, ?string $lastGlue = null): AbstractString |
| 154 | 154 | { |
| 155 | 155 | $str = parent::join($strings, $lastGlue); |
| @@ -178,9 +178,9 @@ | ||
| 178 | 178 | } |
| 179 | 179 | public function prepend(string ...$prefix): AbstractString |
| 180 | 180 | { |
| 181 | 181 | $str = clone $this; |
| 182 | - $str->string = ((1 >= \count($prefix)) ? $prefix[0] ?? '' : implode('', $prefix)) . $this->string; | |
| 182 | + $str->string = (1 >= \count($prefix) ? $prefix[0] ?? '' : implode('', $prefix)) . $this->string; | |
| 183 | 183 | normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string); |
| 184 | 184 | if (\false === $str->string) { |
| 185 | 185 | throw new InvalidArgumentException('Invalid UTF-8 string.'); |
| 186 | 186 | } |
| @@ -274,9 +274,9 @@ | ||
| 274 | 274 | return parent::startsWith($prefix); |
| 275 | 275 | } else { |
| 276 | 276 | $prefix = (string) $prefix; |
| 277 | 277 | } |
| 278 | - $form = (null === $this->ignoreCase) ? \Normalizer::NFD : \Normalizer::NFC; | |
| 278 | + $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC; | |
| 279 | 279 | normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form); |
| 280 | 280 | if ('' === $prefix || \false === $prefix) { |
| 281 | 281 | return \false; |
| 282 | 282 | } |