27 protected $inputs = [];
47 foreach ($this->
getInputs() as $key => $input) {
48 $values[$key] = $input->getValue();
67 $clone->checkArg(
"value", $clone->isClientSideValueOk($values),
"Values given do not match given inputs in group.");
71 foreach ($this->
getInputs() as $key => $input) {
72 $inputs[$key] = $input->withValue($values[$key]);
75 $clone->inputs = $inputs;
90 if (!is_array($value)) {
93 if (!($this->
getInputs() ==
sizeof($value))) {
97 foreach ($this->
getInputs() as $key => $input) {
98 if (!array_key_exists($key, $value)) {
113 public function withInput(
InputData $post_input)
115 $clone = clone $this;
116 $clone = $clone::withInput($post_input);
120 if ($clone->getError()) {
124 return $clone->withGroupInput($post_input);
133 protected function withGroupInput(
InputData $post_input)
138 $clone = clone $this;
147 foreach ($this->
getInputs() as $key => $input) {
148 $filled = $input->withInput($post_input);
153 $content = $filled->getContent();
154 if ($content->isOK()) {
155 $values[$key] = $content->value();
159 $inputs[$key] = $filled;
161 $clone->inputs = $inputs;
164 $clone->content = $clone->data_factory->error(
"error in grouped input");
169 if ($clone->content->value()) {
170 $group_content = $clone->applyOperationsTo($values);
171 $f = $clone->data_factory;
172 $clone->content = $clone->content->then(
function ($value) use (
$f, $group_content) {
173 if ($group_content->isError()) {
174 return $f->error($group_content->error());
177 return $f->ok([
"value" => $value,
"group_values" => $group_content->value()]);
180 $clone->content = $clone->applyOperationsTo($values);
183 if ($clone->content->isError()) {
184 return $clone->withError($clone->content->error());
199 $clone = clone $this;
200 $clone = $clone::withNameFrom($source);
203 foreach ($this->
getInputs() as $key => $input) {
204 $named_inputs[$key] = $input->withNameFrom($source);
207 $clone->inputs = $named_inputs;
218 return $this->inputs;