/** * @param $ans * @param SurveyQuestion $question */ function __construct($ans, SurveyQuestion $question) { switch ($question->getType()->getValue()) { case QuestionType::YesNo: $this->type = ChartFormats::Pie(); $this->yuiType = "pie"; break; case QuestionType::StarRating: $this->type = ChartFormats::Bar(); $this->yuiType = "bar"; break; case QuestionType::Text: $this->type = ChartFormats::TagCloud(); $this->yuiType = null; break; } $this->data = ReportChartFormatter::getChartData($ans, $this->type); $this->question = $question; }