Internal callback funtion for sorting of group objects.

@param  TeamSpeak3_Node_Abstract $a
@param  TeamSpeak3_Node_Abstract $b
@return integer
341532
protected static function sortGroupList(TeamSpeak3_Node_Abstract $a, TeamSpeak3_Node_Abstract $b)
  {
    if(get_class($a) != get_class($b))
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
    }

    if(!$a instanceof TeamSpeak3_Node_Servergroup && !$a instanceof TeamSpeak3_Node_Channelgroup)
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
    }

    if($a->getProperty("sortid", 0) != $b->getProperty("sortid", 0) && $a->getProperty("sortid", 0) != 0 && $b->getProperty("sortid", 0) != 0)
    {
      return ($a->getProperty("sortid", 0) < $b->getProperty("sortid", 0)) ? -1 : 1;
    }

    return ($a->getId() < $b->getId()) ? -1 : 1;
  }
1277586
protected function sortActionsByPriority(array $a, array $b)
    {
        $a = isset($a['priority']) ? $a['priority'] : 0;
        $b = isset($b['priority']) ? $b['priority'] : 0;

        if ($a === $b) {
            return 0;
        }
        return ($a < $b) ? (-1) : 1;
    }
1317941
protected function sortRulesByOrder(AbstractRule $a, AbstractRule $b) {
        if ($a->getOrder() === $b->getOrder()) {
            return 0;
        }

        return $a->getOrder() < $b->getOrder()
            ? -1
            : 1;
    }
363899
public static function depthSort(Section $a, Section $b)
    {
        if ($a->getDepth() == $b->getDepth()) {
            return self::alphaDepthScoreSort($a, $b);
        }
        return $a->getDepth() > $b->getDepth();
    }
442373
protected function sortProperty($a, $b) {
    $property = $this->sortProperty;
    $parent = $this->sortParent;
    if (isset($parent)
        && (isset($a->$parent->$property) || isset($b->$parent->$property))) {
      if (!$this->sortCaseSensitive
          && is_string($a->$parent->$property)
          && is_string($b->$parent->$property)) {
        $aprop = strtoupper($a->$parent->$property);
        $bprop = strtoupper($b->$parent->$property);
        if ($aprop > $bprop) {
          return 1;
        }
        if ($aprop < $bprop) {
          return -1;
        }
      } else {
        if ($a->$parent->$property > $b->$parent->$property) {
          return 1;
        }
        if ($a->$parent->$property < $b->$parent->$property) {
          return -1;
        }
      }
    }
    // If they have the same parent, order them by their own property.
    if (!$this->sortCaseSensitive
        && is_string($a->$property)
        && is_string($b->$property)) {
      $aprop = strtoupper($a->$property);
      $bprop = strtoupper($b->$property);
      if ($aprop > $bprop) {
        return 1;
      }
      if ($aprop < $bprop) {
        return -1;
      }
    } else {
      if ($a->$property > $b->$property) {
        return 1;
      }
      if ($a->$property < $b->$property) {
        return -1;
      }
    }
    return 0;
  }
691444
protected function sortByScore($a, $b)
    {

        if ($a->score == $b->score) {
            return 0;
        }

        return ($a->score > $b->score) ? -1 : 1;

    }
1241400
private function tupleSort(array $a, array $b)
    {
        $max = max(count($a), count($b));
        for ($i = 0; $i < $max; ++$i) {
            if ($a[$i] < $b[$i]) {
                return -1;
            } else {
                if ($a[$i] > $b[$i]) {
                    return 1;
                }
            }
        }

        if (count($a) == count($b)) {
            return 0;
        } else {
            if (count($a) < count($b)) {
                return -1;
            } else {
                return 1;
            }
        }
    }
62778
public function sortAlerts($a, $b)
    {
        if ($a->{'type'} === $b->{'type'}) {
            return 0;
        }

        if (
            ($a->{'type'} === Alert::ERROR && $a->{'type'} !== $b->{'type'})
            || ($a->{'type'} === Alert::SUCCESS && $b->{'type'} === Alert::NOTICE)
        ) {
            return -1;
        }

        return 1;
    }
1244479
protected function sortNodesByIndex(array $nodes)
    {
        usort($nodes, function (NodeData $node1, NodeData $node2) {
            if ($node1->getIndex() < $node2->getIndex()) {
                return -1;
            } elseif ($node1->getIndex() > $node2->getIndex()) {
                return 1;
            } else {
                return strcmp($node1->getIdentifier(), $node2->getIdentifier());
            }
        });

        return $nodes;
    }
486331
protected static function sortGroupList(Node $a, Node $b)
  {
    if(get_class($a) != get_class($b))
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new Exception("invalid parameter", 0x602);
    }

    if(!$a instanceof Servergroup && !$a instanceof Channelgroup)
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new Exception("convert error", 0x604);
    }

    if($a->getProperty("sortid", 0) != $b->getProperty("sortid", 0) && $a->getProperty("sortid", 0) != 0 && $b->getProperty("sortid", 0) != 0)
    {
      return ($a->getProperty("sortid", 0) < $b->getProperty("sortid", 0)) ? -1 : 1;
    }

    return ($a->getId() < $b->getId()) ? -1 : 1;
  }
1011398
public function sortChildren()
    {
        if ($this->hasChildren()) {
            /** @var RouteDefinition $definition */
            foreach ($this->children as $definition) {
                $definition->sortChildren();
            }
            uasort($this->children, function ($a, $b) {
                /** @var RouteDefinition $a */
                /** @var RouteDefinition $b */
                if ($a->getPosition() == $b->getPosition()) {
                    return 0;
                }
                return $a->getPosition() < $b->getPosition() ? -1 : 1;
            });
        }
    }
337396
private function tupleSort($a, $b)
    {
        $aLength = count($a);
        $bLength = count($b);

        if ($aLength > $bLength) {
            $max = $aLength;
        } else {
            $max = $bLength;
        }

        for ($i = 0; $i < $max; ++$i) {
            if ($a[$i] < $b[$i]) {
                return -1;
            }

            if ($a[$i] > $b[$i]) {
                return 1;
            }
        }

        return $aLength <=> $bLength;
    }
391012
protected static function sortItems($a, $b)
    {
        $subpatha = substr($a, 11); // /dashboard
        $subpathb = substr($b, 11); // /dashboard
        $segmentsa = explode('/', $subpatha);
        $segmentsb = explode('/', $subpathb);
        $segmenta = substr($subpatha, 0, strpos($subpatha, '/'));
        $segmentb = substr($subpathb, 0, strpos($subpathb, '/'));
        if (count($segmentsa) == 3 && count($segmentsb) == 3) {
            $subpatha = $segmenta[0] . '/' . $segmenta[1];
            $subpathb = $segmentb[0] . '/' . $segmentb[1];
            $segmenta .= '/' . $segmentsa[1];
            $segmentb .= '/' . $segmentsb[1];
        }

        if (!$segmenta) {
            $segmenta = $subpatha;
        }
        if (!$segmentb) {
            $segmentb = $subpathb;
        }
        $db = Database::connection();
        $displayorderA = intval($db->GetOne('select cDisplayOrder from Pages p inner join PagePaths cp on p.cID = cp.cID where cPath = ?', ['/dashboard/' . $segmenta]));
        $displayorderB = intval($db->GetOne('select cDisplayOrder from Pages p inner join PagePaths cp on p.cID = cp.cID where cPath = ?', ['/dashboard/' . $segmentb]));

        if ($displayorderA > $displayorderB) {
            return 1;
        } elseif ($displayorderA < $displayorderB) {
            return -1;
        } else {
            $displayorderA = intval($db->GetOne('select cDisplayOrder from Pages p inner join PagePaths cp on p.cID = cp.cID where cPath = ?', ['/dashboard/' . $subpatha]));
            $displayorderB = intval($db->GetOne('select cDisplayOrder from Pages p inner join PagePaths cp on p.cID = cp.cID where cPath = ?', ['/dashboard/' . $subpathb]));
            if ($displayorderA > $displayorderB) {
                return 1;
            } elseif ($displayorderA < $displayorderB) {
                return -1;
            }
        }
    }
1139594
public static function date_sort_callback($a, $b) {
		if($a->StartDate == $b->StartDate) {
			if($a->StartTime == $b->StartTime)
				return 0;
			else if(strtotime($a->StartTime) > strtotime($b->StartTime))
				return 1;
			else 
				return -1;
		}
		else if(strtotime($a->StartDate) > strtotime($b->StartDate))
			return 1;
		else 
			return -1;
		
	}
1350349
public function sortNodes($a, $b)
    {
        if ($a->getSort() < $b->getSort()) {
            return -1;
        } elseif ($a->getSort() > $b->getSort()) {
            return 1;
        } elseif ($a->getLeft() < $b->getLeft()) {
            return -1;
        } elseif ($a->getLeft() > $b->getLeft()) {
            return 1;
        }

        return 0;
    }
84864
public static function sortByKeyString($a, $b, $key) {
    $a_title = (is_array($a) && isset($a[$key])) ? $a[$key] : '';
    $b_title = (is_array($b) && isset($b[$key])) ? $b[$key] : '';

    return strnatcasecmp($a_title, $b_title);
  }
284989
public static function sort_permissions($a, $b)
    {
        if ($a['sort'] == $b['sort']) {
            // Same sort value, do alpha instead
            return strcmp($a['name'], $b['name']);
        } else {
            // Just numeric.
            return $a['sort'] < $b['sort'] ? -1 : 1;
        }
    }