protected function sortByPriority(array $list) : array
    {
        $nonPriorityItems = [];
        $priorityItems = [];

        foreach ($list as $key => $priority) {
            if ($priority == -1) {
                $nonPriorityItems[] = $key;
            } else {
                $priorityItems[$key] = $priority;
            }
        }

        asort($priorityItems);

        return array_merge(array_keys($priorityItems), $nonPriorityItems);
    }
protected function sortByPriority(array $list) : array
    {
        $nonPriorityItems = [];
        $priorityItems = [];

        foreach ($list as $key => $priority) {
            if ($priority == -1) {
                $nonPriorityItems[] = $key;
            } else {
                $priorityItems[$key] = $priority;
            }
        }

        asort($priorityItems);

        return array_merge(array_keys($priorityItems), $nonPriorityItems);
    }
protected function sortByPriority ( array $ list ) : array { $ nonPriorityItems = [ ] ; $ priorityItems = [ ] ; foreach ( $ list as $ key => $ priority ) { if ( $ priority == - 1 ) { $ nonPriorityItems [ ] = $ key ; } else { $ priorityItems [ $ key ] = $ priority ; } } asort ( $ priorityItems ) ; return array_merge ( array_keys ( $ priorityItems ) , $ nonPriorityItems ) ; }
Sorts a list whose values are priorities

@param array $list The list to sort
@return array The sorted list
Sorts a list whose values are priorities