ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssLacExclusiveResultExpression.php
Go to the documentation of this file.
1<?php
2
27{
39 public static $pattern = '/\*[0-9]+(?:,[0-9]+)*\*/';
40
44 public static $identifier = "*n,m,o,p*";
45
51 protected $exclusive;
52
53 protected function getPattern(): string
54 {
55 return '/(\d+)/';
56 }
57
65 protected function setMatches($matches): void
66 {
67 $this->exclusive = [];
68
69 foreach ($matches[0] as $match) {
70 $this->exclusive[] = $match;
71 }
72 }
73
77 public function getExclusive(): array
78 {
79 return $this->exclusive;
80 }
81
86 public function getValue(): string
87 {
88 return "*" . join(",", $this->exclusive) . "*";
89 }
90
95 public function getDescription(): string
96 {
97 return join(",", $this->exclusive) . " beantwortet ";
98 }
99
107 public function checkResult($result, $comperator, $index = null): bool
108 {
109 $values = $result->getUserSolutionsByIdentifier("value");
110 $exclusive = $this->getExclusive();
111 sort($values);
113
114 switch ($comperator) {
115 case "=":
116 return $values == $exclusive;
117 break;
118 case "<>":
119 return $values != $exclusive;
120 break;
121 default:
122 return false;
123 }
124 }
125}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...