ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
GroupDecorator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
33{
34 protected Group $input_group;
35
39 public function getValue()
40 {
41 return $this->input_group->getValue();
42 }
43
47 public function withValue($value): self
48 {
49 $clone = clone $this;
50 $clone->setInputGroup($clone->getInputGroup()->withValue($value));
51 return $clone;
52 }
53
57 public function withAdditionalTransformation(Transformation $trafo): self
58 {
59 $clone = clone $this;
60 $clone->setInputGroup($clone->getInputGroup()->withAdditionalTransformation($trafo));
61 return $clone;
62 }
63
67 public function withNameFrom(NameSource $source, ?string $parent_name = null): self
68 {
69 $clone = clone $this;
70 $clone->setInputGroup($clone->getInputGroup()->withNameFrom($source, $parent_name));
71 return $clone;
72 }
73
77 public function withInput(InputData $input): self
78 {
79 $clone = clone $this;
80 $clone->setInputGroup($clone->getInputGroup()->withInput($input));
81 return $clone;
82 }
83
87 public function getContent(): Result
88 {
89 return $this->input_group->getContent();
90 }
91
95 protected function isClientSideValueOk($value): bool
96 {
97 return $this->input_group->isClientSideValueOk($value);
98 }
99
100 public function getInputGroup(): Group
101 {
102 return $this->input_group;
103 }
104
105 protected function setInputGroup(Group $input_group): void
106 {
107 $this->input_group = $input_group;
108 }
109}
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:29
A transformation is a function from one datatype to another.
Groups are a special kind of input because they are a monoid operation.
Definition: Group.php:38
Describes how Input-Elements want to interact with posted data.
Definition: InputData.php:30
Describes a source for input names.
Definition: NameSource.php:27
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
withAdditionalTransformation(Transformation $trafo)
@inheritDoc
withNameFrom(NameSource $source, ?string $parent_name=null)
@inheritDoc