ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilAssLacExclusiveResultExpression.php
Go to the documentation of this file.
1<?php
2
3include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacAbstractExpression.php";
4include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacSolutionExpressionInterface.php";
5
14{
26 public static $pattern = '/\*[0-9]+(?:,[0-9]+)*\*/';
27
31 public static $identifier = "*n,m,o,p*";
32
38 protected $exclusive;
39
40 protected function getPattern()
41 {
42 return '/(\d+)/';
43 }
44
52 protected function setMatches($matches)
53 {
54 $this->exclusive = array();
55
56 foreach ($matches[0] as $match) {
57 $this->exclusive[] = $match;
58 }
59 }
60
64 public function getExclusive()
65 {
66 return $this->exclusive;
67 }
68
73 public function getValue()
74 {
75 return "*" . join(",", $this->exclusive) . "*";
76 }
77
82 public function getDescription()
83 {
84 return join(",", $this->exclusive) . " beantwortet ";
85 }
86
94 public function checkResult($result, $comperator, $index = null)
95 {
96 $values = $result->getUserSolutionsByIdentifier("value");
97 $exclusive = $this->getExclusive();
98 sort($values);
99 sort($exclusive);
100
101 switch ($comperator) {
102 case "=":
103 return $values == $exclusive;
104 break;
105 case "<>":
106 return $values != $exclusive;
107 break;
108 default:
109 return false;
110 }
111 }
112}
$result
An exception for terminatinating execution or to throw for unit testing.
Class ExclusiveResultExpression for the expression m,n,o,p
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
getValue()
Get the value of this Expression.
getPattern()
Get the Pattern to match relevant informations for an Expression.
checkResult($result, $comperator, $index=null)
getDescription()
Get a human readable description of the Composite element.
$index
Definition: metadata.php:128