| @@ -7,13 +7,13 @@ | ||
| 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; | |
| 15 | -use WindPressPackages\Symfony\Component\String\Exception\RuntimeException; | |
| 13 | +use WindPressDeps\Symfony\Component\String\Exception\ExceptionInterface; | |
| 14 | +use WindPressDeps\Symfony\Component\String\Exception\InvalidArgumentException; | |
| 15 | +use WindPressDeps\Symfony\Component\String\Exception\RuntimeException; | |
| 16 | 16 | /** |
| 17 | 17 | * Represents a string of abstract characters. |
| 18 | 18 | * |
| 19 | 19 | * Unicode defines 3 types of "characters" (bytes, code points and grapheme clusters). |
| @@ -74,9 +74,9 @@ | ||
| 74 | 74 | $values[$k] = $v; |
| 75 | 75 | } |
| 76 | 76 | ++$i; |
| 77 | 77 | } |
| 78 | - return (null !== $keys) ? array_combine($keys, $values) : $values; | |
| 78 | + return null !== $keys ? array_combine($keys, $values) : $values; | |
| 79 | 79 | } |
| 80 | 80 | /** |
| 81 | 81 | * @param string|string[] $needle |
| 82 | 82 | * |
| @@ -186,9 +186,9 @@ | ||
| 186 | 186 | */ |
| 187 | 187 | public function bytesAt(int $offset): array |
| 188 | 188 | { |
| 189 | 189 | $str = $this->slice($offset, 1); |
| 190 | - return ('' === $str->string) ? [] : array_values(unpack('C*', $str->string)); | |
| 190 | + return '' === $str->string ? [] : array_values(unpack('C*', $str->string)); | |
| 191 | 191 | } |
| 192 | 192 | /** |
| 193 | 193 | * @return static |
| 194 | 194 | */ |
| @@ -299,9 +299,9 @@ | ||
| 299 | 299 | if (null !== $j && $j < $i) { |
| 300 | 300 | $i = $j; |
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | - return (\PHP_INT_MAX === $i) ? null : $i; | |
| 303 | + return \PHP_INT_MAX === $i ? null : $i; | |
| 304 | 304 | } |
| 305 | 305 | /** |
| 306 | 306 | * @param string|string[] $needle |
| 307 | 307 | */ |
| @@ -461,9 +461,9 @@ | ||
| 461 | 461 | public function toByteString(?string $toEncoding = null): ByteString |
| 462 | 462 | { |
| 463 | 463 | $b = new ByteString(); |
| 464 | 464 | $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], \true) ? 'UTF-8' : $toEncoding; |
| 465 | - if (null === $toEncoding || $toEncoding === $fromEncoding = ($this instanceof AbstractUnicodeString || preg_match('//u', $b->string)) ? 'UTF-8' : 'Windows-1252') { | |
| 465 | + if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') { | |
| 466 | 466 | $b->string = $this->string; |
| 467 | 467 | return $b; |
| 468 | 468 | } |
| 469 | 469 | set_error_handler(static function ($t, $m) { |
| @@ -472,9 +472,9 @@ | ||
| 472 | 472 | try { |
| 473 | 473 | try { |
| 474 | 474 | $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8'); |
| 475 | 475 | } catch (InvalidArgumentException|\ValueError $e) { |
| 476 | - if (!\function_exists('iconv') && !\function_exists('WindPressPackages\iconv')) { | |
| 476 | + if (!\function_exists('iconv') && !\function_exists('WindPressDeps\iconv')) { | |
| 477 | 477 | if ($e instanceof \ValueError) { |
| 478 | 478 | throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); |
| 479 | 479 | } |
| 480 | 480 | throw $e; |
| @@ -572,9 +572,9 @@ | ||
| 572 | 572 | $stringLength = $this->length(); |
| 573 | 573 | if ($stringLength <= $length) { |
| 574 | 574 | return clone $this; |
| 575 | 575 | } |
| 576 | - $ellipsisLength = ('' !== $ellipsis) ? (new static($ellipsis))->length() : 0; | |
| 576 | + $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0; | |
| 577 | 577 | if ($length < $ellipsisLength) { |
| 578 | 578 | $ellipsisLength = 0; |
| 579 | 579 | } |
| 580 | 580 | if (!$cut) { |
| @@ -598,9 +598,9 @@ | ||
| 598 | 598 | * @return static |
| 599 | 599 | */ |
| 600 | 600 | public function wordwrap(int $width = 75, string $break = "\n", bool $cut = \false): self |
| 601 | 601 | { |
| 602 | - $lines = ('' !== $break) ? $this->split($break) : [clone $this]; | |
| 602 | + $lines = '' !== $break ? $this->split($break) : [clone $this]; | |
| 603 | 603 | $chars = []; |
| 604 | 604 | $mask = ''; |
| 605 | 605 | if (1 === \count($lines) && '' === $lines[0]->string) { |
| 606 | 606 | return $lines[0]; |
| @@ -611,9 +611,9 @@ | ||
| 611 | 611 | $mask .= '#'; |
| 612 | 612 | } |
| 613 | 613 | foreach ($line->chunk() as $char) { |
| 614 | 614 | $chars[] = $char->string; |
| 615 | - $mask .= (' ' === $char->string) ? ' ' : '?'; | |
| 615 | + $mask .= ' ' === $char->string ? ' ' : '?'; | |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | $string = ''; |
| 619 | 619 | $j = 0; |