ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
GroupDecorator.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
21 
27 
31 trait GroupDecorator
32 {
33  protected Group $input_group;
34 
38  public function getValue()
39  {
40  return $this->input_group->getValue();
41  }
42 
46  public function withValue($value): self
47  {
48  $clone = clone $this;
49  $clone->setInputGroup($clone->getInputGroup()->withValue($value));
50  return $clone;
51  }
52 
56  public function withAdditionalTransformation(Transformation $trafo): self
57  {
58  $clone = clone $this;
59  $clone->setInputGroup($clone->getInputGroup()->withAdditionalTransformation($trafo));
60  return $clone;
61  }
62 
66  public function withNameFrom(NameSource $source, ?string $parent_name = null): self
67  {
68  $clone = clone $this;
69  $clone->setInputGroup($clone->getInputGroup()->withNameFrom($source, $parent_name));
70  return $clone;
71  }
72 
76  public function withInput(InputData $input): self
77  {
78  $clone = clone $this;
79  $clone->setInputGroup($clone->getInputGroup()->withInput($input));
80  return $clone;
81  }
82 
86  public function getContent(): Result
87  {
88  return $this->input_group->getContent();
89  }
90 
94  protected function isClientSideValueOk($value): bool
95  {
96  return $this->input_group->isClientSideValueOk($value);
97  }
98 
99  public function getInputGroup(): Group
100  {
101  return $this->input_group;
102  }
103 
104  protected function setInputGroup(Group $input_group): void
105  {
106  $this->input_group = $input_group;
107  }
108 }
Describes how Input-Elements want to interact with posted data.
Definition: InputData.php:29
withNameFrom(NameSource $source, ?string $parent_name=null)
A transformation is a function from one datatype to another.
Describes a source for input names.
Definition: NameSource.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21