ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References ILIAS\Repository\initRequest().

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.
+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveId()

ILIAS\Test\RequestDataCollector::getActiveId ( )

Definition at line 90 of file RequestDataCollector.php.

References ILIAS\Repository\int().

90  : int
91  {
92  return $this->int('active_id');
93  }
+ Here is the call graph for this function:

◆ getIds()

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

Definition at line 65 of file RequestDataCollector.php.

References ILIAS\Repository\strArray().

65  : array
66  {
67  return $this->strArray("id");
68  }
+ 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.

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

191  : array|string
192  {
193  $p = $this->http->wrapper()->query();
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.
$r
+ Here is the call graph for this function:

◆ getNextCommand()

ILIAS\Test\RequestDataCollector::getNextCommand ( )

Definition at line 85 of file RequestDataCollector.php.

References ILIAS\Repository\str().

85  : string
86  {
87  return $this->str('nextCommand');
88  }
+ Here is the call graph for this function:

◆ getParsedBody()

ILIAS\Test\RequestDataCollector::getParsedBody ( )

Definition at line 143 of file RequestDataCollector.php.

References ILIAS\FileDelivery\http().

143  : ?array
144  {
145  return $this->http->request()->getParsedBody();
146  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getPassId()

ILIAS\Test\RequestDataCollector::getPassId ( )

Definition at line 95 of file RequestDataCollector.php.

References ILIAS\Repository\int().

95  : int
96  {
97  return $this->int('pass_id');
98  }
+ Here is the call graph for this function:

◆ getPostKeys()

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

Definition at line 151 of file RequestDataCollector.php.

References ILIAS\FileDelivery\http().

151  : array
152  {
153  return $this->http->wrapper()->post()->keys();
154  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getQuestionId()

ILIAS\Test\RequestDataCollector::getQuestionId ( )

Definition at line 75 of file RequestDataCollector.php.

References ILIAS\Repository\int().

75  : int
76  {
77  return $this->int('q_id');
78  }
+ Here is the call graph for this function:

◆ getQuestionIds()

ILIAS\Test\RequestDataCollector::getQuestionIds ( )

Definition at line 80 of file RequestDataCollector.php.

References ILIAS\Repository\intArray().

80  : array
81  {
82  return $this->intArray('q_id');
83  }
+ Here is the call graph for this function:

◆ getRefId()

ILIAS\Test\RequestDataCollector::getRefId ( )

Definition at line 59 of file RequestDataCollector.php.

References ILIAS\Repository\int().

59  : int
60  {
61  return $this->int("ref_id");
62  }
+ Here is the call graph for this function:

◆ getRequest()

ILIAS\Test\RequestDataCollector::getRequest ( )

Definition at line 44 of file RequestDataCollector.php.

References ILIAS\FileDelivery\http().

45  {
46  return $this->http->request();
47  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ hasQuestionId()

ILIAS\Test\RequestDataCollector::hasQuestionId ( )

Definition at line 70 of file RequestDataCollector.php.

References null, and ILIAS\Test\RequestDataCollector\raw().

70  : bool
71  {
72  return $this->raw('q_id') !== null;
73  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ hasRefId()

ILIAS\Test\RequestDataCollector::hasRefId ( )

Definition at line 54 of file RequestDataCollector.php.

References null, and ILIAS\Test\RequestDataCollector\raw().

54  : bool
55  {
56  return $this->raw('ref_id') !== null;
57  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ isInstanceResponseRequested()

ILIAS\Test\RequestDataCollector::isInstanceResponseRequested ( )

Definition at line 115 of file RequestDataCollector.php.

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

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  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ isPostRequest()

ILIAS\Test\RequestDataCollector::isPostRequest ( )

Definition at line 156 of file RequestDataCollector.php.

References ILIAS\FileDelivery\http().

156  : bool
157  {
158  return $this->http->request()->getMethod() === 'POST';
159  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ isset()

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

Definition at line 49 of file RequestDataCollector.php.

References null, and ILIAS\Test\RequestDataCollector\raw().

49  : bool
50  {
51  return $this->raw($key) !== null;
52  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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.

References ILIAS\Repository\refinery().

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

133  : mixed
134  {
135  return $this->get($key, $this->refinery->identity());
136  }
+ 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.

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

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

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  }
static http()
Fetches the global http state from ILIAS.
+ 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.

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

172  : array
173  {
174  return $this->retrieveArrayFromPost($key, $this->refinery->kindlyTo()->int());
175  }
retrieveArrayFromPost(string $key, Transformation $transformation)
+ 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.

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

164  : array
165  {
166  return $this->retrieveArrayFromPost($key, $this->refinery->kindlyTo()->string());
167  }
retrieveArrayFromPost(string $key, Transformation $transformation)
+ Here is the call graph for this function:

◆ retrieveBoolFromPost()

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

Definition at line 100 of file RequestDataCollector.php.

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ strVal()

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

Definition at line 138 of file RequestDataCollector.php.

References ILIAS\Repository\str().

138  : string
139  {
140  return $this->str($key);
141  }
+ 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: