public function getRelevantDataQuestions($gender, $age, $location) { $this->_rawGender = $gender; $this->_rawAge = $age; $this->_rawLocation = $location; $this->_state = $location->getState(); $this->_stateCode = $this->getStateCode($this->_state); $this->_ageRange = $this->getAgeRange($this->_rawAge); if ($this->_stateCode && $this->_ageRange) { // Make sure we get some data if ($this->retrieveData()) { $correctAnswer = $this->getCorrectAnswer(); if ($correctAnswer) { $didYouKnowDataByAge = $this->getDidYouKnowDataByAge(); $question = new DynamicQuizQuestion($this->_questionIds[0]); $question->setNumberFormattingPrefix("\$"); $question->setDescription("In 2013-14, what was the average salary for " . lcfirst($gender) . "s aged " . $this->_ageRange . " in " . $this->_state . "?"); $question->setCorrectAnswer($correctAnswer); $question->setWrongAnswers($this->generateRandomWrongAnswersForNumber($correctAnswer, 40)); // Find the biggest earning group $didYouKnowDataByAgeCopy = $didYouKnowDataByAge; arsort($didYouKnowDataByAgeCopy); $keys = array_keys($didYouKnowDataByAgeCopy); $question->setDidYouKnowHtml("<p><strong>" . ucfirst($gender) . "s aged " . $keys[0] . " were the highest earning " . lcfirst($gender) . "s in " . $this->_state . " in 2013-14, earning an average of \$" . number_format($didYouKnowDataByAge[$keys[0]]) . " per taxable person.</strong></p>" . $question->generateBarChartHtml($didYouKnowDataByAge) . "<p>It's always a good time to take control of your Superannuation!</p>"); return array($question); } } } return array(); }