當前位置: 首頁>>代碼示例>>PHP>>正文


PHP collatorlib::asort_objects_by_method方法代碼示例

本文整理匯總了PHP中collatorlib::asort_objects_by_method方法的典型用法代碼示例。如果您正苦於以下問題:PHP collatorlib::asort_objects_by_method方法的具體用法?PHP collatorlib::asort_objects_by_method怎麽用?PHP collatorlib::asort_objects_by_method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在collatorlib的用法示例。


在下文中一共展示了collatorlib::asort_objects_by_method方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_asort_objects_by_method

 /**
  * Tests the static asort_objects_by_method method
  * @return void
  */
 public function test_asort_objects_by_method()
 {
     $objects = array('b' => new string_test_class('ab'), 1 => new string_test_class('aa'), 0 => new string_test_class('cc'));
     $result = collatorlib::asort_objects_by_method($objects, 'get_protected_name');
     $this->assertSame(array_keys($objects), array(1, 'b', 0));
     $this->assertSame($this->get_ordered_names($objects, 'get_protected_name'), array('aa', 'ab', 'cc'));
     $this->assertTrue($result);
     $objects = array('b' => new string_test_class('a20'), 1 => new string_test_class('a1'), 0 => new string_test_class('a100'));
     $result = collatorlib::asort_objects_by_method($objects, 'get_protected_name', collatorlib::SORT_NATURAL);
     $this->assertSame(array_keys($objects), array(1, 'b', 0));
     $this->assertSame($this->get_ordered_names($objects, 'get_protected_name'), array('a1', 'a20', 'a100'));
     $this->assertTrue($result);
 }
開發者ID:masaterutakeno,項目名稱:MoodleMobile,代碼行數:17,代碼來源:textlib_test.php

示例2: get_list_of_themes

/**
 * Returns a list of valid and compatible themes
 *
 * @return array
 */
function get_list_of_themes()
{
    global $CFG;
    $themes = array();
    if (!empty($CFG->themelist)) {
        // use admin's list of themes
        $themelist = explode(',', $CFG->themelist);
    } else {
        $themelist = array_keys(get_plugin_list("theme"));
    }
    foreach ($themelist as $key => $themename) {
        $theme = theme_config::load($themename);
        $themes[$themename] = $theme;
    }
    collatorlib::asort_objects_by_method($themes, 'get_theme_name');
    return $themes;
}
開發者ID:nmicha,項目名稱:moodle,代碼行數:22,代碼來源:moodlelib.php

示例3: test_asort_objects_by_method

 function test_asort_objects_by_method()
 {
     $objects = array('b' => new string_test_class('ab'), 1 => new string_test_class('aa'), 0 => new string_test_class('cc'));
     collatorlib::asort_objects_by_method($objects, 'get_protected_name');
     $this->assertIdentical(array_keys($objects), array(1, 'b', 0));
     $this->assertIdentical($this->get_ordered_names($objects, 'get_protected_name'), array('aa', 'ab', 'cc'));
     $objects = array('a' => new string_test_class('áb'), 'b' => new string_test_class('ab'), 1 => new string_test_class('aa'), 0 => new string_test_class('cc'));
     collatorlib::asort_objects_by_method($objects, 'get_private_name');
     $this->assertIdentical(array_keys($objects), array(1, 'b', 'a', 0), $this->error);
     $this->assertIdentical($this->get_ordered_names($objects, 'get_private_name'), array('aa', 'ab', 'áb', 'cc'), $this->error);
 }
開發者ID:,項目名稱:,代碼行數:11,代碼來源:


注:本文中的collatorlib::asort_objects_by_method方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。