Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 297 Bytes

03-sorters.md

File metadata and controls

16 lines (11 loc) · 297 Bytes

Sorters

Sorters can be used to sort the final result.

Sorters are only applied when calling FormatterInterface::formatMany.

Usage

$sorter = function (array $data) {
    // Sort by count in descending order.
    return $data['count'] * -1;
};

$formatter->addSorter($sorter);