27 protected $inputs = [];
47 foreach ($this->
getInputs() as $key => $input) {
48 $values[$key] = $input->getValue();
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 (!
sizeof($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 = parent::withInput($post_input);
119 if ($clone->getError()) {
123 return $clone->withGroupInput($post_input);
132 protected function withGroupInput(
InputData $post_input)
143 foreach ($this->
getInputs() as $key => $input) {
144 $filled = $input->withInput($post_input);
149 $content = $filled->getContent();
150 if ($content->isOk()) {
151 $values[$key] = $content->value();
155 $inputs[$key] = $filled;
157 $clone->inputs = $inputs;
160 $clone->content = $clone->data_factory->error(
"error in grouped input");
165 if ($clone->content->value()) {
166 $group_content = $clone->applyOperationsTo($values);
167 $f = $this->data_factory;
168 $clone->content = $clone->content->then(
function ($value) use (
$f, $group_content) {
169 if ($group_content->isError()) {
170 return $f->error($group_content->error());
173 return $f->ok([
"value" => $value,
"group_values" => $group_content->value()]);
176 $clone->content = $clone->applyOperationsTo($values);
179 if ($clone->content->isError()) {
180 return $clone->withError($clone->content->error());
192 $clone = parent::withNameFrom($source);
197 foreach ($this->
getInputs() as $key => $input) {
198 $named_inputs[$key] = $input->withNameFrom($source);
201 $clone->inputs = $named_inputs;
212 return $this->inputs;
checkArg($which, $check, $message)
/** Throw an InvalidArgumentException containing the message if $check is false.