select( self::tb_str, array(), array( 'id' => $id_int ) ); if ( empty( $rows_arr ) ){ throw new \RuntimeException( 'Invalid quiz ID' ); } $this->id_int = $rows_arr[0]['id']; $this->name_str = $rows_arr[0]['name']; $this->maxScore_int = $rows_arr[0]['max_score']; $this->questionID_arr = Question::getList( $this->id_int ); } /** * Get a list of quiz IDs and names * * @return string[] Array of quiz names keyed by id */ public static function getList(){ $db = DB::getDB(); $quiz_arr = $db->select( self::tb_str, array( 'id', 'name' ) ); return $quiz_arr; } /** * Get name of Quiz * * @return string Name */ public function getName(){ return $this->name_str; } /** * Get Maximum possible Score of quiz * * @return int Max score */ public function getMaxScore(){ return $this->maxScore_int; } }