You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
468 B

  1. <?php
  2. class AsciiSortedIterator extends SplHeap
  3. {
  4. public function __construct(Iterator $iterator)
  5. {
  6. foreach ($iterator as $item) {
  7. $this->insert($item);
  8. }
  9. }
  10. public function compare($b,$a)
  11. {
  12. /**
  13. * @var $a SplFileInfo
  14. * @var $b SplFileInfo
  15. */
  16. return strcmp($a->getPath() . DIRECTORY_SEPARATOR . $a->getFileName(), $b->getPath() . DIRECTORY_SEPARATOR . $b->getFileName());
  17. }
  18. }