19declare(strict_types=1);
28use Psr\Http\Message\ServerRequestInterface;
45 return $this->
http->request();
48 public function isset(
string $key): bool
50 return $this->
raw($key) !==
null;
55 return $this->
raw(
'ref_id') !==
null;
60 return $this->
int(
'ref_id');
71 return $this->
raw(
'q_id') !==
null;
76 return $this->
int(
'q_id');
86 return $this->
str(
'nextCommand');
91 return $this->
int(
'active_id');
96 return $this->
int(
'pass_id');
101 if (!$this->
http->wrapper()->post()->has($key)) {
105 return $this->
http->wrapper()->post()->retrieve(
108 $this->refinery->kindlyTo()->bool(),
109 $this->refinery->always(
null)
116 if (!$this->
http->wrapper()->query()->has(
'instresp')) {
120 return $this->
http->wrapper()->query()->retrieve(
123 $this->refinery->kindlyTo()->bool(),
124 $this->refinery->always(
false)
132 public function raw(
string $key): mixed
134 return $this->
get($key, $this->
refinery->identity());
137 public function strVal(
string $key): string
139 return $this->
str($key);
144 return $this->
http->request()->getParsedBody();
152 return $this->
http->wrapper()->post()->keys();
157 return $this->
http->request()->getMethod() ===
'POST';
178 return $this->
http->wrapper()->post()->retrieve(
181 $this->refinery->kindlyTo()->listOf($transformation),
182 $this->refinery->always([])
189 return $this->
get($key, $this->
refinery->byTrying([
191 $this->refinery->kindlyTo()->string(),
192 $this->refinery->custom()->transformation(fn(array $v):
string|
int => $v[0])
201 $query = $this->
http->wrapper()->query();
203 if (!$query->has($key)) {
207 return $query->retrieve(
209 $this->
refinery->custom()->transformation(
210 static fn(array|
string $value): array|
string => $value ===
'ALL_OBJECTS' || $value[0] ===
'ALL_OBJECTS'
212 : array_map(
'intval', $value)
trait BaseGUIRequest
Base gui request wrapper.
retrieveArrayFromPost(string $key, Transformation $transformation)
isInstanceResponseRequested()
retrieveArrayOfIntsFromPost(string $key)
retrieveArrayOfStringsFromPost(string $key)
retrieveBoolFromPost(string $key)
__construct(HTTPServices $http, Refinery $refinery)
getRowIdParameter(string $key)
getMultiSelectionIds(string $key)
static http()
Fetches the global http state from ILIAS.
initRequest(HTTP\Services $http, Refinery\Factory $refinery, ?array $passed_query_params=null, ?array $passed_post_data=null)
Query params and post data parameters are used for testing.