public function order($order, $context)
{
if (!$order) {
return array();
}
if (is_string($order)) {
return array($order => 1);
}
if (!is_array($order)) {
return array();
}
foreach ($order as $key => $value) {
if (!is_string($key)) {
unset($order[$key]);
$order[$value] = 1;
continue;
}
if (is_string($value)) {
$order[$key] = strtolower($value) === 'asc' ? 1 : -1;
}
}
return $order;
}