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