Sort function for sorting entries

@param  array  $item1
@param  array  $item2
@return number
164462
protected function cmpSvnEntriesByKind(array $item1, array $item2)
    {
        $item1['name'] = strtolower($item1['name']);
        $item2['name'] = strtolower($item2['name']);

        return ($item1['kind'] == 'dir'
                ? ($item2['kind'] == 'dir' ? strnatcmp($item1['name'], $item2['name']) : -1)
                : ($item2['kind'] == 'dir' ? 1 : strnatcmp($item1['name'], $item2['name'])
                ));
    }
901874
function sortRankedItems(a, b) {
  const aFirst = -1
  const bFirst = 1
  const {rank: aRank, index: aIndex, keyIndex: aKeyIndex} = a
  const {rank: bRank, index: bIndex, keyIndex: bKeyIndex} = b
  const same = aRank === bRank
  if (same) {
    if (aKeyIndex === bKeyIndex) {
      return aIndex < bIndex ? aFirst : bFirst
    } else {
      return aKeyIndex < bKeyIndex ? aFirst : bFirst
    }
  } else {
    return aRank > bRank ? aFirst : bFirst
  }
}
576710
public function indexOf( $item ) {

			for ( $i=0; $i < $this->len; $i++ ) {

				if ( $this->compare( $item, $this->items[$i] ) === 0 ) {
					return $i;
				}

			}

			return -1;

		}
157258
function(file1, file2) {
		var self  = this,
			type  = self.sortType,
			asc   = self.sortOrder == 'asc',
			stick = self.sortStickFolders,
			rules = self.sortRules,
			sort  = rules[type],
			d1    = file1.mime == 'directory',
			d2    = file2.mime == 'directory',
			res;
			
		if (stick) {
			if (d1 && !d2) {
				return -1;
			} else if (!d1 && d2) {
				return 1;
			}
		}
		
		res = asc ? sort(file1, file2) : sort(file2, file1);
		
		return type !== 'name' && res === 0
			? res = asc ? rules.name(file1, file2) : rules.name(file2, file1)
			: res;
	}
857830
private function sortByStartDate(Period $interval1, Period $interval2): int
    {
        return $interval1->getStartDate() <=> $interval2->getStartDate();
    }
175456
private static function objectDiffInArrays($array1, $array2)
	{
		return array_udiff($array1, $array2, function($a, $b) {
			if ($a === $b) {
				return 0;
			} elseif ($a < $b) {
				return -1;
			} elseif ($a > $b) {
				return 1;
			}
		});
	}
143387
protected function indexOf($item)
    {
        if (false !== ($index = array_search($item, $this->_data, true)))
            return $index;
        else
            return -1;
    }
1175778
protected static function sortFileList(array $a, array $b)
  {
    if(!array_key_exists("src", $a) || !array_key_exists("src", $b) || !array_key_exists("type", $a) || !array_key_exists("type", $b))
    {
      return 0;

      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
    }
    
    if($a["type"] != $b["type"])
    {
      return ($a["type"] < $b["type"]) ? -1 : 1;
    }

    return strcmp(strtolower($a["src"]), strtolower($b["src"]));
  }
276032
protected function sortByFields($key1, $key2)
    {
        $key1Parts = $this->explodeKey($key1);
        $key2Parts = $this->explodeKey($key2);

        $flag = 0;

        foreach ($this->orderByFieldIndices as $index => $order) {
            if ($flag !== 0) {
                break;
            }

            if ($key1Parts[$index] > $key2Parts[$index]) {
                $flag = $order == 'asc' ? 1 : -1;
            } elseif ($key1Parts[$index] < $key2Parts[$index]) {
                $flag = $order == 'asc' ? -1 : 1;
            } else {
                $flag = 0;
            }
        }

        return $flag;
    }
389728
function sort(array &$var,$col,$order=SORT_ASC) {
		uasort(
			$var,
			function($val1,$val2) use($col,$order) {
				list($v1,$v2)=[$val1[$col],$val2[$col]];
				$out=is_numeric($v1) && is_numeric($v2)?
					Base::instance()->sign($v1-$v2):strcmp($v1,$v2);
				if ($order==SORT_DESC)
					$out=-$out;
				return $out;
			}
		);
		$var=array_values($var);
	}
38390
protected function sortItems(&$items)
    {
        $this->safeUaSortItems($items, function ($item1, $item2) {
            if (empty($item1['order']) || empty($item2['order']) || $item1['order'] == $item2['order']) {
                return 0;
            }

            return ($item1['order'] < $item2['order']) ? -1 : 1;
        });
    }
577481
function sort(array, compare) {
  for (var i = 1; i < array.length; i++) {
    var item = array[i];
    var indexHole = i;
    while (indexHole > 0 && compare(array[indexHole - 1], item) > 0) {
      array[indexHole] = array[--indexHole];
    }
    array[indexHole] = item;
    if (sortExternal.shiftObserver) {
      sortExternal.shiftObserver(i, indexHole);
    }
  }

  return array;
}
728200
private function sortTabs(OrderedTabInterface $tab1, OrderedTabInterface $tab2): int
    {
        return $tab1->getOrder() <=> $tab2->getOrder();
    }
608189
private function sortChildren()
    {
        uasort(
            $this->children,
            function (MapperTreeItemInterface $first, MapperTreeItemInterface $second) {
                if ($first->getPriority() >= $second->getPriority()) {
                    return 1;
                }

                if ($first->getPriority() < $second->getPriority()) {
                    return -1;
                }
            }
        );
    }
194186
private function sortItemsToDays($items)
    {
        $all = [];

        foreach ($items as $item)
        {
            // date
            $timestamp = strtotime($item->created_at) * 1000;
            $day = Carbon::createFromFormat('Y-m-d H:i:s', $item->created_at)->format('Y-m-d');

            // init empty day
            if (!isset($all[$day])) {
                $all[$day] = [
                    'timestamp' => $timestamp,
                    'date' => $day,
                    'count' => 0,
                ];
            }

            // increase count
            $all[$day]['count']++;
        }

        return $all;
    }
558410
public function sortItems( eZPageBlockItem $a, eZPageBlockItem $b )
    {
        if ( $a->attribute('priority') == $b->attribute('priority') )
        {
            if ( $a->attribute('ts_publication') > $b->attribute('ts_publication') )
            {
                return 1;
            }
            else if ( $a->attribute('ts_publication') < $b->attribute('ts_publication') )
            {
                return -1;
            }
            else
            {
                return 0;
            }
        }
        else if ( $a->attribute('priority') > $b->attribute('priority') )
        {
            return -1;
        }
        else if ( $a->attribute('priority') < $b->attribute('priority') )
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
189906
function (item) {
        item.value.sort(function (a, b) {
            if (a.key < b.key) {
                return -1;
            }
            /* istanbul ignore next */
            // Below line exists only for the sake of completeness. Generally the array will
            // always be sorted, and therefore it is impossible to get to this state in a test.
            return a.key > b.key ? 1 : 0;
        });
        return item;
    }