NativeSort.php 501 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @file
  4. * NativeSort.php
  5. *
  6. * @author: marand
  7. *
  8. * @license General Public License version 2 or later
  9. */
  10. namespace OSInet\Sort;
  11. /**
  12. * Class NativeSort: use PHP builtin usort() function.
  13. *
  14. * @package OSInet\Sort
  15. *
  16. * @see http://en.wikipedia.org/wiki/Insertion_sort
  17. */
  18. class NativeSort extends Sort {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function sort($data, $comparison, $options = array()) {
  23. $sorted = $data;
  24. usort($sorted, $comparison);
  25. return $sorted;
  26. }
  27. }