ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Test\RequestDataCollector Class Reference
+ Inheritance diagram for ILIAS\Test\RequestDataCollector:
+ Collaboration diagram for ILIAS\Test\RequestDataCollector:

Public Member Functions

 __construct (HTTPServices $http, Refinery $refinery)
 
 getRequest ()
 
 isset (string $key)
 
 hasRefId ()
 
 getRefId ()
 
 getIds ()
 
 hasQuestionId ()
 
 getQuestionId ()
 
 getQuestionIds ()
 
 getNextCommand ()
 
 getActiveId ()
 
 getPassId ()
 
 retrieveBoolFromPost (string $key)
 
 isInstanceResponseRequested ()
 
 raw (string $key)
 
 strVal (string $key)
 
 getParsedBody ()
 
 getPostKeys ()
 
 isPostRequest ()
 
 retrieveArrayOfStringsFromPost (string $key)
 
 retrieveArrayOfIntsFromPost (string $key)
 
 getRowIdParameter (string $key)
 
 getMultiSelectionIds (string $key)
 
 getRequest ()
 
 isset (string $key)
 
 hasRefId ()
 
 getRefId ()
 
 hasQuestionId ()
 
 getQuestionId ()
 
 getIds ()
 
 raw (string $key)
 
 getParsedBody ()
 
 getPostKeys ()
 
 getMultiSelectionIds (string $key)
 
 getRowIdParameter (string $key)
 

Protected Attributes

array $params
 

Private Member Functions

 retrieveArrayFromPost (string $key, Transformation $transformation)
 

Detailed Description

Definition at line 30 of file RequestDataCollector.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\RequestDataCollector::__construct ( HTTPServices  $http,
Refinery  $refinery 
)

Definition at line 36 of file RequestDataCollector.php.

39 {
40 $this->initRequest($http, $refinery);
41 }
$http
Definition: deliver.php:30
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.

References ILIAS\UI\examples\Layout\Page\Mail\$refinery, and ILIAS\Repository\initRequest().

+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveId()

ILIAS\Test\RequestDataCollector::getActiveId ( )

Definition at line 89 of file RequestDataCollector.php.

89 : int
90 {
91 return $this->int('active_id');
92 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getIds()

ILIAS\Test\RequestDataCollector::getIds ( )
Returns
string[]

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 64 of file RequestDataCollector.php.

64 : array
65 {
66 return $this->strArray('id');
67 }

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getMultiSelectionIds()

ILIAS\Test\RequestDataCollector::getMultiSelectionIds ( string  $key)
Returns
array|string<int>

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 199 of file RequestDataCollector.php.

199 : array|string
200 {
201 $query = $this->http->wrapper()->query();
202
203 if (!$query->has($key)) {
204 return [];
205 }
206
207 return $query->retrieve(
208 $key,
209 $this->refinery->custom()->transformation(
210 static fn(array|string $value): array|string => $value === 'ALL_OBJECTS' || $value[0] === 'ALL_OBJECTS'
211 ? 'ALL_OBJECTS'
212 : array_map('intval', $value)
213 )
214 );
215 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getNextCommand()

ILIAS\Test\RequestDataCollector::getNextCommand ( )

Definition at line 84 of file RequestDataCollector.php.

84 : string
85 {
86 return $this->str('nextCommand');
87 }

References ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getParsedBody()

ILIAS\Test\RequestDataCollector::getParsedBody ( )

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 142 of file RequestDataCollector.php.

142 : ?array
143 {
144 return $this->http->request()->getParsedBody();
145 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getPassId()

ILIAS\Test\RequestDataCollector::getPassId ( )

Definition at line 94 of file RequestDataCollector.php.

94 : int
95 {
96 return $this->int('pass_id');
97 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getPostKeys()

ILIAS\Test\RequestDataCollector::getPostKeys ( )
Deprecated:

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 150 of file RequestDataCollector.php.

150 : array
151 {
152 return $this->http->wrapper()->post()->keys();
153 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getQuestionId()

ILIAS\Test\RequestDataCollector::getQuestionId ( )

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 74 of file RequestDataCollector.php.

74 : int
75 {
76 return $this->int('q_id');
77 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getQuestionIds()

ILIAS\Test\RequestDataCollector::getQuestionIds ( )

Definition at line 79 of file RequestDataCollector.php.

79 : array
80 {
81 return $this->intArray('q_id');
82 }

References ILIAS\Repository\intArray().

+ Here is the call graph for this function:

◆ getRefId()

ILIAS\Test\RequestDataCollector::getRefId ( )

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 58 of file RequestDataCollector.php.

58 : int
59 {
60 return $this->int('ref_id');
61 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getRequest()

ILIAS\Test\RequestDataCollector::getRequest ( )

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 43 of file RequestDataCollector.php.

43 : ServerRequestInterface
44 {
45 return $this->http->request();
46 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getRowIdParameter()

ILIAS\Test\RequestDataCollector::getRowIdParameter ( string  $key)

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 187 of file RequestDataCollector.php.

187 : string|int
188 {
189 return $this->get($key, $this->refinery->byTrying([
190 $this->refinery->kindlyTo()->int(),
191 $this->refinery->kindlyTo()->string(),
192 $this->refinery->custom()->transformation(fn(array $v): string|int => $v[0])
193 ]));
194 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ hasQuestionId()

ILIAS\Test\RequestDataCollector::hasQuestionId ( )

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 69 of file RequestDataCollector.php.

69 : bool
70 {
71 return $this->raw('q_id') !== null;
72 }

References ILIAS\Test\RequestDataCollector\raw().

+ Here is the call graph for this function:

◆ hasRefId()

ILIAS\Test\RequestDataCollector::hasRefId ( )

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 53 of file RequestDataCollector.php.

53 : bool
54 {
55 return $this->raw('ref_id') !== null;
56 }

References ILIAS\Test\RequestDataCollector\raw().

+ Here is the call graph for this function:

◆ isInstanceResponseRequested()

ILIAS\Test\RequestDataCollector::isInstanceResponseRequested ( )

Definition at line 114 of file RequestDataCollector.php.

114 : bool
115 {
116 if (!$this->http->wrapper()->query()->has('instresp')) {
117 return false;
118 }
119
120 return $this->http->wrapper()->query()->retrieve(
121 'instresp',
122 $this->refinery->byTrying([
123 $this->refinery->kindlyTo()->bool(),
124 $this->refinery->always(false)
125 ])
126 );
127 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ isPostRequest()

ILIAS\Test\RequestDataCollector::isPostRequest ( )

Definition at line 155 of file RequestDataCollector.php.

155 : bool
156 {
157 return $this->http->request()->getMethod() === 'POST';
158 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ isset()

ILIAS\Test\RequestDataCollector::isset ( string  $key)

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 48 of file RequestDataCollector.php.

48 : bool
49 {
50 return $this->raw($key) !== null;
51 }

References ILIAS\Test\RequestDataCollector\raw().

+ Here is the call graph for this function:

◆ raw()

ILIAS\Test\RequestDataCollector::raw ( string  $key)
Returns
mixed|null

Implements ILIAS\TestQuestionPool\RequestDataCollectorInterface.

Definition at line 132 of file RequestDataCollector.php.

132 : mixed
133 {
134 return $this->get($key, $this->refinery->identity());
135 }

References ILIAS\Repository\refinery().

Referenced by ILIAS\Test\RequestDataCollector\hasQuestionId(), ILIAS\Test\RequestDataCollector\hasRefId(), and ILIAS\Test\RequestDataCollector\isset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveArrayFromPost()

ILIAS\Test\RequestDataCollector::retrieveArrayFromPost ( string  $key,
Transformation  $transformation 
)
private

Definition at line 176 of file RequestDataCollector.php.

176 : array
177 {
178 return $this->http->wrapper()->post()->retrieve(
179 $key,
180 $this->refinery->byTrying([
181 $this->refinery->kindlyTo()->listOf($transformation),
182 $this->refinery->always([])
183 ])
184 );
185 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Test\RequestDataCollector\retrieveArrayOfIntsFromPost(), and ILIAS\Test\RequestDataCollector\retrieveArrayOfStringsFromPost().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveArrayOfIntsFromPost()

ILIAS\Test\RequestDataCollector::retrieveArrayOfIntsFromPost ( string  $key)
Returns
array<int>

Definition at line 171 of file RequestDataCollector.php.

171 : array
172 {
173 return $this->retrieveArrayFromPost($key, $this->refinery->kindlyTo()->int());
174 }
retrieveArrayFromPost(string $key, Transformation $transformation)

References ILIAS\Repository\refinery(), and ILIAS\Test\RequestDataCollector\retrieveArrayFromPost().

+ Here is the call graph for this function:

◆ retrieveArrayOfStringsFromPost()

ILIAS\Test\RequestDataCollector::retrieveArrayOfStringsFromPost ( string  $key)
Returns
array<string>

Definition at line 163 of file RequestDataCollector.php.

163 : array
164 {
165 return $this->retrieveArrayFromPost($key, $this->refinery->kindlyTo()->string());
166 }

References ILIAS\Repository\refinery(), and ILIAS\Test\RequestDataCollector\retrieveArrayFromPost().

+ Here is the call graph for this function:

◆ retrieveBoolFromPost()

ILIAS\Test\RequestDataCollector::retrieveBoolFromPost ( string  $key)

Definition at line 99 of file RequestDataCollector.php.

99 : ?bool
100 {
101 if (!$this->http->wrapper()->post()->has($key)) {
102 return null;
103 }
104
105 return $this->http->wrapper()->post()->retrieve(
106 $key,
107 $this->refinery->byTrying([
108 $this->refinery->kindlyTo()->bool(),
109 $this->refinery->always(null)
110 ])
111 );
112 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ strVal()

ILIAS\Test\RequestDataCollector::strVal ( string  $key)

Definition at line 137 of file RequestDataCollector.php.

137 : string
138 {
139 return $this->str($key);
140 }

References ILIAS\Repository\str().

+ Here is the call graph for this function:

Field Documentation

◆ $params

array ILIAS\Test\RequestDataCollector::$params
protected

Definition at line 34 of file RequestDataCollector.php.


The documentation for this class was generated from the following file: