1 | <?php |
||
13 | abstract class InputParam implements ParamInterface |
||
14 | { |
||
15 | const TYPE_POST = 'POST'; |
||
16 | const TYPE_GET = 'GET'; |
||
17 | const TYPE_PUT = 'PUT'; |
||
18 | const TYPE_FILE = 'FILE'; |
||
19 | const TYPE_COOKIE = 'COOKIE'; |
||
20 | const TYPE_POST_RAW = 'POST_RAW'; |
||
21 | const TYPE_POST_JSON = 'POST_JSON'; |
||
22 | |||
23 | const OPTIONAL = false; |
||
24 | const REQUIRED = true; |
||
25 | |||
26 | /** @var string */ |
||
27 | protected $type; |
||
28 | |||
29 | /** @var string */ |
||
30 | protected $key; |
||
31 | |||
32 | /** @var bool */ |
||
33 | protected $required = self::OPTIONAL; |
||
34 | |||
35 | /** @var array|null */ |
||
36 | protected $availableValues = null; |
||
37 | |||
38 | /** @var bool */ |
||
39 | protected $multi = false; |
||
40 | |||
41 | /** @var string */ |
||
42 | protected $description = ''; |
||
43 | |||
44 | /** @var mixed */ |
||
45 | protected $default; |
||
46 | |||
47 | /** @var mixed */ |
||
48 | protected $example; |
||
49 | |||
50 | 72 | public function __construct(string $key) |
|
54 | |||
55 | 45 | public function setRequired(): self |
|
60 | |||
61 | 24 | public function setAvailableValues(array $availableValues): self |
|
66 | |||
67 | 12 | public function setMulti(): self |
|
72 | |||
73 | 21 | public function getType(): string |
|
77 | |||
78 | 36 | public function getKey(): string |
|
82 | |||
83 | 21 | public function isRequired(): bool |
|
87 | |||
88 | 12 | public function getAvailableValues(): ?array |
|
92 | |||
93 | 45 | public function isMulti(): bool |
|
97 | |||
98 | 3 | public function setDescription(string $description): self |
|
103 | |||
104 | 3 | public function getDescription(): string |
|
108 | |||
109 | /** |
||
110 | * @param mixed $default |
||
111 | * @return self |
||
112 | */ |
||
113 | 3 | public function setDefault($default): self |
|
118 | |||
119 | /** |
||
120 | * @return mixed |
||
121 | */ |
||
122 | 12 | public function getDefault() |
|
126 | |||
127 | /** |
||
128 | * @param mixed $example |
||
129 | * @return self |
||
130 | */ |
||
131 | 3 | public function setExample($example): self |
|
136 | |||
137 | /** |
||
138 | * @return mixed |
||
139 | */ |
||
140 | 12 | public function getExample() |
|
144 | |||
145 | 12 | public function updateConsoleForm(Form $form): void |
|
164 | |||
165 | 6 | protected function addFormInput(Form $form, string $key): BaseControl |
|
173 | |||
174 | 12 | protected function getLabel(): string |
|
178 | |||
179 | 12 | protected function getParamLabel(): string |
|
188 | |||
189 | /** |
||
190 | * Check if actual value from environment is valid |
||
191 | */ |
||
192 | 21 | public function validate(): ValidationResultInterface |
|
212 | } |
||
213 |