public function compare($a, $b)
{
$result = null;
if (isset($this->collator)) {
try {
$a = (string) $a;
$b = (string) $b;
if ($this->caseSensitive) {
$result = $this->collator->compare($a, $b);
} else {
$array = array($a, $b);
if ($this->sort($array) === false) {
$result = false;
} else {
$ia = array_search($a, $array);
if ($ia === 1) {
$result = 1;
} else {
$ib = array_search($b, $array);
if ($ib === 1) {
$result = -1;
} else {
$result = 0;
}
}
}
}
} catch (PHPException $x) {
}
}
if ($result === null) {
$a = $this->normalize($a);
$b = $this->normalize($b);
$result = $this->caseSensitive ? strnatcmp($a, $b) : strnatcasecmp($a, $b);
}
return $result;
}