ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssLacOrderingResultExpression.php
Go to the documentation of this file.
1 <?php
2 
27 {
38  public static $pattern = '/\$[0-9]+(?:,[0-9]+)*\$/';
39 
43  public static $identifier = '$n,m,o,p$';
44 
50  protected $ordering;
51 
52  protected function getPattern(): string
53  {
54  return '/(\d+)/';
55  }
56 
64  protected function setMatches($matches): void
65  {
66  $this->ordering = array();
67 
68  foreach ($matches[0] as $match) {
69  $this->ordering[] = $match;
70  }
71  }
72 
76  public function getOrdering(): array
77  {
78  return $this->ordering;
79  }
80 
85  public function getValue(): string
86  {
87  return "$" . join(",", $this->ordering) . "$";
88  }
89 
94  public function getDescription(): string
95  {
96  return join(",", $this->ordering) . " beantwortet ";
97  }
98 
106  public function checkResult($result, $comperator, $index = null): bool
107  {
108  $keys = $result->getUserSolutionsByIdentifier("key");
109  $keys = array_filter($keys, function ($element) {
110  return $element != null;
111  });
112 
113  switch ($comperator) {
114  case "=":
115  return $keys == $this->getOrdering();
116  break;
117  case "<>":
118  return $keys != $this->getOrdering();
119  break;
120  default:
121  return false;
122  }
123  }
124 }
getValue()
Get the value of this Expression.
getDescription()
Get a human readable description of the Composite element.
$index
Definition: metadata.php:145
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$keys
Definition: metadata.php:204
checkResult($result, $comperator, $index=null)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...