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


PHP Game::getID方法代碼示例

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


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

示例1: __construct

 /**
  * Constructs a GroupRequestQueue with entries matching the specified game and step.
  * 
  * @param Game $game the desired game
  * @param Round $round the desired round
  */
 public function __construct(Game $game, Round $round)
 {
     $this->requests = array();
     $dbh = Database::handle();
     $sth = $dbh->prepare('SELECT * FROM group_requests WHERE game = :game AND step = :step');
     $sth->bindValue(':game', $game->getID());
     $sth->bindValue(':step', strval($round));
     $sth->execute();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $expires = Util::sql2unixtime($row['expires']);
         if ($expires == 0) {
             $expires = NULL;
         }
         $this->requests[] = new GroupRequest(Session::fromSessionID($row['session']), $expires);
     }
 }
開發者ID:nmalkin,項目名稱:basset,代碼行數:22,代碼來源:grouprequestqueue.php

示例2: getGroup

 /** @deprecated */
 public static function getGroup(Game $game, $step, Session $session)
 {
     $dbh = Database::handle();
     // find all groups with this game and step
     $sth = $dbh->prepare('SELECT * FROM groups WHERE game = :game AND step = :step');
     $sth->bindValue(':game', $game->getID());
     $sth->bindValue(':step', $step);
     $sth->execute();
     // find one that contains this session
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $session_ids = unserialize($row['sessions']);
         if (in_array($session->id, $session_ids)) {
             // use it to construct the group
             $sessions = array_map(function ($session_id) {
                 return Session::fromSessionID($session_id);
             }, $session_ids);
             return new Group($row['id'], $sessions, unserialize($row['data']));
         }
     }
     // couldn't find anything!
     throw new Exception('could not find group with matching game, step, and session');
 }
開發者ID:nmalkin,項目名稱:basset,代碼行數:23,代碼來源:group.php

示例3: fromAssignmentID

 /**
  * Returns the session identified by the given assignment id.
  * 
  * @param string $assignment_id the AMT assignment ID, a unique ID given by Amazon to each assignment
  * @param Game $game the game associated with this assignment (should be known because HitId is also passed)
  * @throws DoesNotExistException if there is no session with this assignment ID and game
  */
 public static function fromAssignmentID($assignment_id, Game $game)
 {
     $game_id = $game->getID();
     $dbh = Database::handle();
     $sth = $dbh->prepare('SELECT session_id FROM sessions WHERE assignment_id = ? AND game = ?');
     $sth->execute(array($assignment_id, $game_id));
     if ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $session_id = $row['session_id'];
         return self::fromSessionID($session_id);
     } else {
         throw new DoesNotExistException('unknown assignment id');
     }
 }
開發者ID:nmalkin,項目名稱:basset,代碼行數:20,代碼來源:session.php


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