/** * @param ilUserQuestionResult $result * @param string $comperator * @param null|int $index * * @return bool */ public function checkResult($result, $comperator, $index = null) { $isTrue = false; if ($index == null) { $values = $result->getUserSolutionsByIdentifier("key"); foreach ($values as $value) { $isTrue = $isTrue || $this->compare($comperator, $value); } } else { $solution = $result->getSolutionForKey($index); $isTrue = $this->compare($comperator, $solution["value"]); } return $isTrue; }
/** * @param ilUserQuestionResult $result * @param string $comperator * @param null|int $index * * @return bool */ public function checkResult($result, $comperator, $index = null) { $values = $result->getUserSolutionsByIdentifier("value"); $exclusive = $this->getExclusive(); sort($values); sort($exclusive); switch ($comperator) { case "=": return $values == $exclusive; break; case "<>": return $values != $exclusive; break; default: return false; } }
/** * @param ilUserQuestionResult $result * @param string $comperator * @param null|int $index * * @return bool */ public function checkResult($result, $comperator, $index = null) { $keys = $result->getUserSolutionsByIdentifier("key"); $keys = array_filter($keys, function ($element) { return $element != null; }); switch ($comperator) { case "=": return $keys == $this->getOrdering(); break; case "<>": return $keys != $this->getOrdering(); break; default: return false; } }