-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAdditionalFormParams.php
46 lines (40 loc) · 1.07 KB
/
AdditionalFormParams.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Core\Request\Parameters;
class AdditionalFormParams extends MultipleParams
{
/**
* Initializes an AdditionalFormParams object.
*/
public static function init(?array $values): self
{
return new self($values ?? []);
}
private function __construct(array $values)
{
parent::__construct('additional form');
$this->parameters = array_map(function ($key, $val) {
return FormParam::init($key, $val);
}, array_keys($values), $values);
}
/**
* Turns all parameters of the object to unIndexed.
*/
public function unIndexed(): self
{
$this->parameters = array_map(function ($param) {
return $param->unIndexed();
}, $this->parameters);
return $this;
}
/**
* Turns all parameters of the object to plain.
*/
public function plain(): self
{
$this->parameters = array_map(function ($param) {
return $param->plain();
}, $this->parameters);
return $this;
}
}