stablesort() 공개 정적인 메소드

Adapted from http://stackoverflow.com/a/4353844/21728 / http://php.net/manual/en/function.usort.php#38827
public static stablesort ( &$array, string $cmp_function = 'strcmp' )
$array
$cmp_function string
 /**
  * @param TrackedChangeInfo[] $changeInfoList
  * @return TrackedChangeInfo[]
  */
 private function sortChangeInfoList($changeInfoList)
 {
     ArrayUtils::stablesort($changeInfoList, function ($changeInfo1, $changeInfo2) {
         /** @var TrackedChangeInfo|BulkChangeInfo $changeInfo1 */
         /** @var TrackedChangeInfo|BulkChangeInfo $changeInfo2 */
         return $changeInfo1->getPriority() - $changeInfo2->getPriority();
     });
     return $changeInfoList;
 }
예제 #2
0
 function sort($changeInfoList)
 {
     ArrayUtils::stablesort($changeInfoList, array($this, 'compareChangeInfo'));
     return $changeInfoList;
 }
예제 #3
0
 private static function getRelatedHooks($tag, $hookType)
 {
     $relatedHooks = isset(self::$hooks[$hookType][$tag]) ? self::$hooks[$hookType][$tag] : [];
     ArrayUtils::stablesort($relatedHooks, function ($hook1, $hook2) {
         return $hook1['priority'] - $hook2['priority'];
     });
     return $relatedHooks;
 }