ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
NormalizeCarry.php
Go to the documentation of this file.
1<?php
2
4
7
11final class NormalizeCarry
12{
13 private bool $has_result = false;
15 private array|float|bool|int|string|null $result = null;
16
20 public function __construct(
21 private readonly Transformations $transformations,
22 private readonly mixed $value,
23 private readonly array $context,
24 ) {
25 }
26
28 {
29 return $this->transformations;
30 }
31
32 public function value(): mixed
33 {
34 return $this->value;
35 }
36
38 public function context(): array
39 {
40 return $this->context;
41 }
42
43 public function hasResult(): bool
44 {
45 return $this->has_result;
46 }
47
49 public function setResult(array|float|bool|int|string|null $result): void
50 {
51 $this->result = $result;
52 $this->has_result = true;
53 }
54
61 public function result(): array|float|bool|int|string|null
62 {
63 if ($this->has_result === false) {
64 throw new NormalizingException('Unsupported value', $this->value);
65 }
66 return $this->result;
67 }
68}
Exception thrown when a value cannot be normalized or denormalized.
Carries a value, context and eventual result through normalization processors.
__construct(private readonly Transformations $transformations, private readonly mixed $value, private readonly array $context,)
Provides a set of transformations for normalizing and denormalizing values.