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


PHP Unit::getAll方法代碼示例

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


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

示例1: createFromTimePeriod

 /**
  * Create weight object from timePeriod widget value
  * @param   mixed
  * @return  Weight|null
  */
 public static function createFromTimePeriod($arrData)
 {
     $arrData = deserialize($arrData);
     if (empty($arrData) || !is_array($arrData) || $arrData['value'] === '' || $arrData['unit'] === '' || !in_array($arrData['unit'], Unit::getAll())) {
         return null;
     }
     return new static($arrData['value'], $arrData['unit']);
 }
開發者ID:codefog,項目名稱:contao-haste,代碼行數:13,代碼來源:Weight.php

示例2: find

 static function find($search_id)
 {
     $found_unit = NULL;
     $units = Unit::getAll();
     foreach ($units as $unit) {
         $unit_id = $unit->getId();
         if ($unit_id == $search_id) {
             $found_unit = $unit;
         }
     }
     return $found_unit;
 }
開發者ID:kylepratuch,項目名稱:EdBuilder,代碼行數:12,代碼來源:Unit.php

示例3: testUpdateUnit

 function testUpdateUnit()
 {
     $name = "John Doe";
     $password = "password";
     $email = "johndoe@osa.biz";
     $signed_in = 0;
     $test_user = new User($name, $password, $email, $signed_in);
     $test_user->save();
     $course_title = "Literature";
     $subject = "English";
     $course_description = "Deconstructing English literature.";
     $user_id = $test_user->getId();
     $test_course = new Course($course_title, $subject, $course_description, $user_id);
     $test_course->save();
     $unit_title = "Into the Wild";
     $unit_description = "The life and death of Chris McCandless.";
     $course_id = $test_course->getId();
     $test_unit = new Unit($unit_title, $unit_description, $course_id);
     $test_unit->save();
     $unit_title2 = "The Catcher in the Rye";
     $unit_description2 = "Foul-mouthed kid is angsty.";
     $test_unit->updateUnit($unit_title2, $unit_description2);
     $result = Unit::getAll();
     $this->assertEquals($test_unit, $result[0]);
 }
開發者ID:kylepratuch,項目名稱:EdBuilder,代碼行數:25,代碼來源:UnitTest.php


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