19 declare(strict_types=1);
41 $this->objectivesByQuestion = [];
42 $this->objectivesTitles = [];
51 $this->objectivesByQuestion[$questionId] = $objectiveIds;
60 if (!isset($this->objectivesByQuestion[$questionId])) {
64 return (
bool) count($this->objectivesByQuestion[$questionId]);
72 return $this->objectivesByQuestion[$questionId];
77 foreach ($this->objectivesByQuestion as $objectiveIds) {
78 foreach ($objectiveIds as $objectiveId) {
79 if (!isset($this->objectivesTitles[$objectiveId])) {
81 $this->objectivesTitles[$objectiveId] = $objectiveTitle;
93 if (!isset($this->objectivesByQuestion[$questionId])
94 || !is_array($this->objectivesByQuestion[$questionId])) {
99 foreach ($this->objectivesByQuestion[$questionId] as $objectiveId) {
100 $titles[] = $this->objectivesTitles[$objectiveId];
103 return implode(
', ', $titles);
108 return implode(
', ', $this->objectivesTitles);
113 $objectiveTitles = [];
115 foreach ($this->objectivesByQuestion as $questionId => $objectiveIds) {
116 if (!in_array($questionId, $questionIds)) {
120 foreach ($objectiveIds as $objectiveId) {
121 $objectiveTitles[$objectiveId] = $this->objectivesTitles[$objectiveId];
125 return implode(
', ', $objectiveTitles);
130 return $this->objectivesTitles[$objectiveId];
140 if (!isset($this->objectivesByQuestion[$questionId])
141 || !is_array($this->objectivesByQuestion[$questionId])) {
145 foreach ($this->objectivesByQuestion[$questionId] as $relatedObjectiveId) {
146 if ($relatedObjectiveId == $objectiveId) {
156 $filteredResults = [];
158 foreach ($testResults as $questionId => $resultData) {
163 $filteredResults[$questionId] = $resultData;
166 return $filteredResults;
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)