2014-11-26 13:36:06 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2015-02-26 13:37:37 +03:00
|
|
|
* Copyright (c) 2014 Vincent Petry <PVince81@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
2014-11-26 13:36:06 +03:00
|
|
|
*
|
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
2014-11-26 13:36:06 +03:00
|
|
|
namespace OC;
|
|
|
|
|
|
|
|
class NaturalSort_DefaultCollator {
|
|
|
|
public function compare($a, $b) {
|
2015-02-25 01:50:38 +03:00
|
|
|
$result = strcasecmp($a, $b);
|
|
|
|
if ($result === 0) {
|
|
|
|
if ($a === $b) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ($a > $b) ? -1 : 1;
|
2014-11-26 13:36:06 +03:00
|
|
|
}
|
2015-02-25 01:50:38 +03:00
|
|
|
return ($result < 0) ? -1 : 1;
|
2014-11-26 13:36:06 +03:00
|
|
|
}
|
|
|
|
}
|