| Total Complexity | 2 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class NaturalFileSorter implements FileSorterInterface |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var ClosureFileSorter; |
||
| 25 | */ |
||
| 26 | private $sorter; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Constructor. |
||
| 30 | */ |
||
| 31 | public function __construct() |
||
| 32 | { |
||
| 33 | 6 | $naturalSorter = function (SplFileInfo $a, SplFileInfo $b) { |
|
| 34 | 1 | return strnatcasecmp($a->getRealPath(), $b->getRealPath()); |
|
| 35 | 6 | }; |
|
| 36 | |||
| 37 | 6 | $this->sorter = new ClosureFileSorter($naturalSorter); |
|
| 38 | 6 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Sort files using natural order. |
||
| 42 | * |
||
| 43 | * @param SplFileInfo[] $fileInfos |
||
| 44 | * |
||
| 45 | * @return SplFileInfo[] |
||
| 46 | */ |
||
| 47 | 1 | public function sort(array $fileInfos) |
|
| 50 | } |
||
| 51 | } |
||
| 52 |