ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\RequestDataCollector Class Reference
+ 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)
 
 getMultiSelectionIds (string $key)
 

Protected Attributes

array $params
 

Private Member Functions

 retrieveArrayFromPost (string $key, Transformation $transformation)
 

Detailed Description

Definition at line 31 of file RequestDataCollector.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 37 of file RequestDataCollector.php.

40 {
41 $this->initRequest($http, $refinery);
42 }
$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\Standard\$refinery, and ILIAS\Repository\initRequest().

+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveId()

ILIAS\Test\RequestDataCollector::getActiveId ( )

Definition at line 90 of file RequestDataCollector.php.

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

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getIds()

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

Definition at line 65 of file RequestDataCollector.php.

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

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getMultiSelectionIds()

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

Definition at line 191 of file RequestDataCollector.php.

191 : array|string
192 {
193 $p = $this->http->wrapper()->query();
194 $r = $this->refinery;
195
196 if (!$p->has($key)) {
197 return [];
198 }
199
200 return $p->retrieve(
201 $key,
202 $r->custom()->transformation(function ($value) {
203 return $value === 'ALL_OBJECTS' || $value[0] === 'ALL_OBJECTS' ? 'ALL_OBJECTS' : array_map('intval', $value);
204 })
205 );
206 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\UI\examples\Layout\Page\Standard\$refinery, and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getNextCommand()

ILIAS\Test\RequestDataCollector::getNextCommand ( )

Definition at line 85 of file RequestDataCollector.php.

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

References ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getParsedBody()

ILIAS\Test\RequestDataCollector::getParsedBody ( )

Definition at line 143 of file RequestDataCollector.php.

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

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getPassId()

ILIAS\Test\RequestDataCollector::getPassId ( )

Definition at line 95 of file RequestDataCollector.php.

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

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getPostKeys()

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

Definition at line 151 of file RequestDataCollector.php.

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

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getQuestionId()

ILIAS\Test\RequestDataCollector::getQuestionId ( )

Definition at line 75 of file RequestDataCollector.php.

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

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getQuestionIds()

ILIAS\Test\RequestDataCollector::getQuestionIds ( )

Definition at line 80 of file RequestDataCollector.php.

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

References ILIAS\Repository\intArray().

+ Here is the call graph for this function:

◆ getRefId()

ILIAS\Test\RequestDataCollector::getRefId ( )

Definition at line 59 of file RequestDataCollector.php.

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

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getRequest()

ILIAS\Test\RequestDataCollector::getRequest ( )

Definition at line 44 of file RequestDataCollector.php.

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

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ hasQuestionId()

ILIAS\Test\RequestDataCollector::hasQuestionId ( )

Definition at line 70 of file RequestDataCollector.php.

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

References ILIAS\Test\RequestDataCollector\raw().

+ Here is the call graph for this function:

◆ hasRefId()

ILIAS\Test\RequestDataCollector::hasRefId ( )

Definition at line 54 of file RequestDataCollector.php.

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

References ILIAS\Test\RequestDataCollector\raw().

+ Here is the call graph for this function:

◆ isInstanceResponseRequested()

ILIAS\Test\RequestDataCollector::isInstanceResponseRequested ( )

Definition at line 115 of file RequestDataCollector.php.

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

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

+ Here is the call graph for this function:

◆ isPostRequest()

ILIAS\Test\RequestDataCollector::isPostRequest ( )

Definition at line 156 of file RequestDataCollector.php.

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

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ isset()

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

Definition at line 49 of file RequestDataCollector.php.

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

References ILIAS\Test\RequestDataCollector\raw().

+ Here is the call graph for this function:

◆ raw()

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

Definition at line 133 of file RequestDataCollector.php.

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

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 177 of file RequestDataCollector.php.

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

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 172 of file RequestDataCollector.php.

172 : array
173 {
174 return $this->retrieveArrayFromPost($key, $this->refinery->kindlyTo()->int());
175 }
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 164 of file RequestDataCollector.php.

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

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 100 of file RequestDataCollector.php.

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

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 138 of file RequestDataCollector.php.

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

References ILIAS\Repository\str().

+ Here is the call graph for this function:

Field Documentation

◆ $params

array ILIAS\Test\RequestDataCollector::$params
protected

Definition at line 35 of file RequestDataCollector.php.


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