cubicl / php-sorting
A sorting library for PHP
Installs: 4 412
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.0.2
- phpstan/phpstan: ^1.10.15
- phpunit/phpunit: ^9.6.8
This package is auto-updated.
Last update: 2024-10-31 00:23:21 UTC
README
Implementation of a generic sorting system with an interface definition compatible to the Comparable RFC.
Usage
You have two possible options. Depending on your use case you can implement the
Cubicl\Sorting\Comparable
interface or use a comparator.
<?php // with a comparable $orderedList = $sortManager->sortComparable($unorderedListOfComparable); // or with a comparator $orderedList = $sortManager->sortWithComparator($comparator, $unorderedList);