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