ILIAS  release_8 Revision v8.24
GroupDecorator.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
21
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): Input
48 {
49 $clone = clone $this;
50 $clone->setInputGroup($clone->getInputGroup()->withValue($value));
51 return $clone;
52 }
53
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): Input
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): Input
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}
This implements commonalities between inputs.
Definition: Input.php:43
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Result.php:15
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:37
This describes commonalities between all inputs.
Definition: Input.php:49
Describes how Input-Elements want to interact with posted data.
Definition: InputData.php:30
Describes a source for input names.
Definition: NameSource.php:27
$source
Definition: metadata.php:93
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