ILIAS  release_8 Revision v8.23
RangeDimension.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 namespace ILIAS\Data\Dimension;
23 
28 {
30 
31  public function __construct(CardinalDimension $cardinal_dimension)
32  {
33  $this->cardinal_dimension = $cardinal_dimension;
34  $this->value_labels = $this->cardinal_dimension->getLabels();
35  }
36 
37  public function checkValue($value): void
38  {
39  if (is_null($value)) {
40  return;
41  }
42  if (!is_array($value)) {
43  throw new \InvalidArgumentException(
44  "Expected parameter to be null or an array with exactly two numeric parameters.
45  '$value' is given."
46  );
47  } elseif (count($value) !== 2) {
48  throw new \InvalidArgumentException(
49  "Expected parameter to be an array with exactly two numeric parameters."
50  );
51  } else {
52  foreach ($value as $number) {
53  $this->cardinal_dimension->checkValue($number);
54  }
55  }
56  }
57 }
__construct(CardinalDimension $cardinal_dimension)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...