Skip to content

CubiclDev/php-sorting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cubicl\Sorting Module

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);