Skip to content

Commit

Permalink
add hash at the end of array
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsmartinez committed Feb 2, 2017
1 parent 4dcd244 commit fe8ff3a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/typeform/Typeform.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,19 +541,26 @@ protected function getRows()
$rows = [];
foreach ($this->getResponses() as $response) {

$hash = '';
$fields = [];
foreach ($this->getQuestions() as $question_id => $question_name) {
$rr = '';
if (isset($response['answers'][$question_id])) {
$rr = $response['answers'][$question_id];
} elseif (isset($response['hidden'][$question_name])) {
$rr = $response['hidden'][$question_name];
if ($question_name == 'hash') {
$hash = $rr;
}

}
$fields[] = $rr;
}

$fields[] = isset($response['answers']['score']) ? $response['answers']['score'] : 0;
$rows[] = array_map('utf8_decode', $fields);
$fields[] = $hash;
//$rows[] = array_map('utf8_decode', $fields);
$rows[] = $fields;
}

return $rows;
Expand Down

0 comments on commit fe8ff3a

Please sign in to comment.