ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RangeDimension.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Data\Dimension;
22
27{
29
31 {
32 $this->cardinal_dimension = $cardinal_dimension;
33 $this->value_labels = $this->cardinal_dimension->getLabels();
34 }
35
36 public function checkValue($value): void
37 {
38 if (is_null($value)) {
39 return;
40 }
41 if (!is_array($value)) {
42 throw new \InvalidArgumentException(
43 "Expected parameter to be null or an array with exactly two numeric parameters.
44 '$value' is given."
45 );
46 } elseif (count($value) !== 2) {
47 throw new \InvalidArgumentException(
48 "Expected parameter to be an array with exactly two numeric parameters."
49 );
50 } else {
51 foreach ($value as $number) {
52 $this->cardinal_dimension->checkValue($number);
53 }
54 }
55 }
56}
__construct(CardinalDimension $cardinal_dimension)