/** * Comparator function to sort files by date * * @param \OCP\Files\FileInfo $a file * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ public static function compareTimestamp(FileInfo $a, FileInfo $b) { $aTime = $a->getMTime(); $bTime = $b->getMTime(); return $aTime < $bTime ? -1 : 1; }
/** * Comparator function to sort files by date * * @param \OCP\Files\FileInfo $a file * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ public static function compareTimestamp($a, $b) { $aTime = $a->getMTime(); $bTime = $b->getMTime(); return $aTime - $bTime; }