public function sortDivisions()
{
if (!$this->divisionsHaveBeenSorted) {
$sortIndex = [];
$sortPosition = [];
foreach ($this->divisions as $key => $division) {
/** @var \Browscap\Data\Division $division */
$sortIndex[$key] = $division->getSortIndex();
$sortPosition[$key] = $key;
}
array_multisort($sortIndex, SORT_ASC, SORT_NUMERIC, $sortPosition, SORT_DESC, SORT_NUMERIC, $this->divisions);
$this->divisionsHaveBeenSorted = true;
}
return $this;
}