19declare(strict_types=1);
42 if (!is_string($name)) {
43 throw new \InvalidArgumentException(
44 "Expected array key to be a string, '$name' is given."
48 throw new \InvalidArgumentException(
49 "Expected array value to be an instance of Dimension." .
50 (is_object($dimension) ? get_class($dimension) : gettype($dimension)) .
" is given."
57 if (!is_string($group_name)) {
58 throw new \InvalidArgumentException(
59 "Expected array key to be a string, '$group_name' is given."
63 throw new \InvalidArgumentException(
64 "Expected array value to be an instance of DimensionGroup. " .
65 (is_object($group) ? get_class($group) : gettype($group)) .
" is given."
93 throw new \ArgumentCountError(
94 "The number of the passed values does not match with the number of Dimensions."
104 public function withPoint(
string $measurement_item_label, array $values): self
108 foreach ($values as $dimension_name => $value) {
110 $dimension->checkValue($value);
113 $clone = clone $this;
114 $clone->points[$measurement_item_label] = $values;
126 $points_restructured = [];
127 foreach ($this->
getPoints() as $measurement_item_label => $points_for_dimensions) {
128 foreach ($points_for_dimensions as $dimension_name => $point) {
129 $points_restructured[$dimension_name][$measurement_item_label] = $point;
133 return $points_restructured;
145 foreach ($values as $dimension_name => $value) {
146 if (!is_string($value) && !is_null($value)) {
147 throw new \InvalidArgumentException(
148 "Expected array value to be a string or null, '$value' is given."
153 $clone = clone $this;
154 $clone->alternative_information[$measurement_item_label] = $values;
166 $alternative_information_restructured = [];
168 foreach ($alternative_information_for_dimensions as $dimension_name => $alternative_info) {
169 $alternative_information_restructured[$dimension_name][$measurement_item_label] = $alternative_info;
173 return $alternative_information_restructured;
181 $clone = clone $this;
183 $clone->alternative_information = [];
198 throw new \RuntimeException(
199 "Dataset must not be empty."
205 foreach ($dimension_points as $point) {
206 if (is_array($point)) {
207 foreach ($point as $p) {
208 if (is_null($min) || $p < $min) {
212 } elseif (is_null($min) || !is_null($point) && $point < $min) {
223 throw new \RuntimeException(
224 "Dataset must not be empty."
230 foreach ($dimension_points as $point) {
231 if (is_array($point)) {
232 foreach ($point as $p) {
233 if (is_null($max) || $p > $max) {
237 } elseif (is_null($max) || !is_null($point) && $point > $max) {
getAlternativeInformationPerDimension()
__construct(array $dimensions, array $dimension_groups=[])
withAlternativeInformation(string $measurement_item_label, array $values)
withPoint(string $measurement_item_label, array $values)
getAlternativeInformation()
getMinValueForDimension(string $dimension_name)
array $alternative_information
checkDimensionCongruenceForValues(array $values)
withResetDataset()
Returns an empty Dataset clone.
getMaxValueForDimension(string $dimension_name)