コード例 #1
0
 /**
  * @param array $answers The answers to pass.
  *
  * @return QuestionSet The scored QuestionSet.
  */
 protected function _score($answers)
 {
     $url = static::instanceUrl() . '/score';
     // Weird request requires us to build the cURL request manually
     $params = array();
     foreach ($answers as $key => $value) {
         $params[] = "answers[][question_id]={$value['question_id']}";
         $params[] = "answers[][answer_id]={$value['answer_id']}";
     }
     $response = static::_makeRequest('post', $url, implode('&', $params));
     return Util\Util::convertToBlockScoreObject($response);
 }
コード例 #2
0
 /**
  * @param array $answers The answers to pass.
  *
  * @return QuestionSet The scored QuestionSet.
  */
 protected function _score($answers)
 {
     $url = static::instanceUrl() . '/score';
     // Weird request requires us to build the cURL request manually
     $params = '';
     foreach ($answers as $key => $value) {
         $params = $params . 'answers[][{$key}]={$value}&';
     }
     rtrim($params, '&');
     $response = static::_makeRequest('post', $url, $params);
     return Util\Util::convertToBlockScoreObject($response);
 }