1 | <?php |
||
11 | abstract class InputParam implements ParamInterface |
||
12 | { |
||
13 | const TYPE_POST = 'POST'; |
||
14 | const TYPE_GET = 'GET'; |
||
15 | const TYPE_PUT = 'PUT'; |
||
16 | const TYPE_FILE = 'FILE'; |
||
17 | const TYPE_COOKIE = 'COOKIE'; |
||
18 | const TYPE_POST_RAW = 'POST_RAW'; |
||
19 | const TYPE_POST_JSON = 'POST_JSON'; |
||
20 | |||
21 | const OPTIONAL = false; |
||
22 | const REQUIRED = true; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected $type; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $key; |
||
29 | |||
30 | /** @var bool */ |
||
31 | protected $required = self::OPTIONAL; |
||
32 | |||
33 | /** @var array|null */ |
||
34 | protected $availableValues = null; |
||
35 | |||
36 | /** @var bool */ |
||
37 | protected $multi = false; |
||
38 | |||
39 | /** @var string */ |
||
40 | protected $description = ''; |
||
41 | |||
42 | /** @var mixed */ |
||
43 | protected $default; |
||
44 | |||
45 | /** @var mixed */ |
||
46 | protected $example; |
||
47 | |||
48 | 72 | public function __construct(string $key) |
|
52 | |||
53 | 45 | public function setRequired(): self |
|
58 | |||
59 | 24 | public function setAvailableValues(array $availableValues): self |
|
64 | |||
65 | 12 | public function setMulti(): self |
|
70 | |||
71 | 21 | public function getType(): string |
|
75 | |||
76 | 36 | public function getKey(): string |
|
80 | |||
81 | 21 | public function isRequired(): bool |
|
85 | |||
86 | 12 | public function getAvailableValues(): ?array |
|
90 | |||
91 | 45 | public function isMulti(): bool |
|
95 | |||
96 | 3 | public function setDescription(string $description): self |
|
101 | |||
102 | 3 | public function getDescription(): string |
|
106 | |||
107 | /** |
||
108 | * @param mixed $default |
||
109 | * @return self |
||
110 | */ |
||
111 | 3 | public function setDefault($default): self |
|
116 | |||
117 | /** |
||
118 | * @return mixed |
||
119 | */ |
||
120 | 12 | public function getDefault() |
|
124 | |||
125 | /** |
||
126 | * @param mixed $example |
||
127 | * @return self |
||
128 | */ |
||
129 | 3 | public function setExample($example): self |
|
134 | |||
135 | /** |
||
136 | * @return mixed |
||
137 | */ |
||
138 | 12 | public function getExample() |
|
142 | |||
143 | 12 | public function updateConsoleForm(Form $form): void |
|
162 | |||
163 | 6 | protected function addFormInput(Form $form, string $key): BaseControl |
|
171 | |||
172 | 12 | protected function getLabel(): string |
|
176 | |||
177 | 12 | protected function getParamLabel(): string |
|
186 | |||
187 | /** |
||
188 | * Check if actual value from environment is valid |
||
189 | */ |
||
190 | 21 | public function validate(): ValidationResultInterface |
|
210 | } |
||
211 |