| @@ 425-435 (lines=11) @@ | ||
| 422 | /** |
|
| 423 | * {@inheritdoc} |
|
| 424 | */ |
|
| 425 | public function sort(int $flags = self::SORT_REGULAR): CollectionInterface |
|
| 426 | { |
|
| 427 | $values = $this->values; |
|
| 428 | $bool = sort($values, $flags); |
|
| 429 | ||
| 430 | if ($bool === false) { |
|
| 431 | throw new SortException('Sort failure'); |
|
| 432 | } |
|
| 433 | ||
| 434 | return new self($values); |
|
| 435 | } |
|
| 436 | ||
| 437 | /** |
|
| 438 | * {@inheritdoc} |
|
| @@ 440-450 (lines=11) @@ | ||
| 437 | /** |
|
| 438 | * {@inheritdoc} |
|
| 439 | */ |
|
| 440 | public function associativeSort(int $flags = self::SORT_REGULAR): CollectionInterface |
|
| 441 | { |
|
| 442 | $values = $this->values; |
|
| 443 | $bool = asort($values, $flags); |
|
| 444 | ||
| 445 | if ($bool === false) { |
|
| 446 | throw new SortException('Sort failure'); |
|
| 447 | } |
|
| 448 | ||
| 449 | return new self($values); |
|
| 450 | } |
|
| 451 | ||
| 452 | /** |
|
| 453 | * {@inheritdoc} |
|
| @@ 455-465 (lines=11) @@ | ||
| 452 | /** |
|
| 453 | * {@inheritdoc} |
|
| 454 | */ |
|
| 455 | public function keySort(int $flags = self::SORT_REGULAR): CollectionInterface |
|
| 456 | { |
|
| 457 | $values = $this->values; |
|
| 458 | $bool = ksort($values, $flags); |
|
| 459 | ||
| 460 | if ($bool === false) { |
|
| 461 | throw new SortException('Sort failure'); |
|
| 462 | } |
|
| 463 | ||
| 464 | return new self($values); |
|
| 465 | } |
|
| 466 | ||
| 467 | /** |
|
| 468 | * {@inheritdoc} |
|
| @@ 470-480 (lines=11) @@ | ||
| 467 | /** |
|
| 468 | * {@inheritdoc} |
|
| 469 | */ |
|
| 470 | public function ukeySort(callable $sorter): CollectionInterface |
|
| 471 | { |
|
| 472 | $values = $this->values; |
|
| 473 | $bool = uksort($values, $sorter); |
|
| 474 | ||
| 475 | if ($bool === false) { |
|
| 476 | throw new SortException('Sort failure'); |
|
| 477 | } |
|
| 478 | ||
| 479 | return new self($values); |
|
| 480 | } |
|
| 481 | ||
| 482 | /** |
|
| 483 | * {@inheritdoc} |
|
| @@ 485-495 (lines=11) @@ | ||
| 482 | /** |
|
| 483 | * {@inheritdoc} |
|
| 484 | */ |
|
| 485 | public function reverseSort(int $flags = self::SORT_REGULAR): CollectionInterface |
|
| 486 | { |
|
| 487 | $values = $this->values; |
|
| 488 | $bool = rsort($values, $flags); |
|
| 489 | ||
| 490 | if ($bool === false) { |
|
| 491 | throw new SortException('Sort failure'); |
|
| 492 | } |
|
| 493 | ||
| 494 | return new self($values); |
|
| 495 | } |
|
| 496 | ||
| 497 | /** |
|
| 498 | * {@inheritdoc} |
|
| @@ 500-510 (lines=11) @@ | ||
| 497 | /** |
|
| 498 | * {@inheritdoc} |
|
| 499 | */ |
|
| 500 | public function usort(callable $sorter): CollectionInterface |
|
| 501 | { |
|
| 502 | $values = $this->values; |
|
| 503 | $bool = usort($values, $sorter); |
|
| 504 | ||
| 505 | if ($bool === false) { |
|
| 506 | throw new SortException('Sort failure'); |
|
| 507 | } |
|
| 508 | ||
| 509 | return new self($values); |
|
| 510 | } |
|
| 511 | ||
| 512 | /** |
|
| 513 | * {@inheritdoc} |
|
| @@ 515-525 (lines=11) @@ | ||
| 512 | /** |
|
| 513 | * {@inheritdoc} |
|
| 514 | */ |
|
| 515 | public function associativeReverseSort(int $flags = self::SORT_REGULAR): CollectionInterface |
|
| 516 | { |
|
| 517 | $values = $this->values; |
|
| 518 | $bool = arsort($values, $flags); |
|
| 519 | ||
| 520 | if ($bool === false) { |
|
| 521 | throw new SortException('Sort failure'); |
|
| 522 | } |
|
| 523 | ||
| 524 | return new self($values); |
|
| 525 | } |
|
| 526 | ||
| 527 | /** |
|
| 528 | * {@inheritdoc} |
|
| @@ 530-540 (lines=11) @@ | ||
| 527 | /** |
|
| 528 | * {@inheritdoc} |
|
| 529 | */ |
|
| 530 | public function keyReverseSort(int $flags = self::SORT_REGULAR): CollectionInterface |
|
| 531 | { |
|
| 532 | $values = $this->values; |
|
| 533 | $bool = krsort($values, $flags); |
|
| 534 | ||
| 535 | if ($bool === false) { |
|
| 536 | throw new SortException('Sort failure'); |
|
| 537 | } |
|
| 538 | ||
| 539 | return new self($values); |
|
| 540 | } |
|
| 541 | ||
| 542 | /** |
|
| 543 | * {@inheritdoc} |
|
| @@ 545-555 (lines=11) @@ | ||
| 542 | /** |
|
| 543 | * {@inheritdoc} |
|
| 544 | */ |
|
| 545 | public function uassociativeSort(callable $sorter): CollectionInterface |
|
| 546 | { |
|
| 547 | $values = $this->values; |
|
| 548 | $bool = uasort($values, $sorter); |
|
| 549 | ||
| 550 | if ($bool === false) { |
|
| 551 | throw new SortException('Sort failure'); |
|
| 552 | } |
|
| 553 | ||
| 554 | return new self($values); |
|
| 555 | } |
|
| 556 | ||
| 557 | /** |
|
| 558 | * {@inheritdoc} |
|
| @@ 560-570 (lines=11) @@ | ||
| 557 | /** |
|
| 558 | * {@inheritdoc} |
|
| 559 | */ |
|
| 560 | public function naturalSort(): CollectionInterface |
|
| 561 | { |
|
| 562 | $values = $this->values; |
|
| 563 | $bool = natsort($values); |
|
| 564 | ||
| 565 | if ($bool === false) { |
|
| 566 | throw new SortException('Sort failure'); |
|
| 567 | } |
|
| 568 | ||
| 569 | return new self($values); |
|
| 570 | } |
|
| 571 | ||
| 572 | /** |
|
| 573 | * {@inheritdoc} |
|