ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Profile\GUIRequest Class Reference
+ Collaboration diagram for ILIAS\User\Profile\GUIRequest:

Public Member Functions

 __construct (RequestServices $request, private Refinery $refinery)
 
 getUserId ()
 
 getBackUrl ()
 
 getBaseClass ()
 
 getPrompted ()
 
 getOsdId ()
 
 getFieldId ()
 
 getTerm ()
 
 getToken ()
 
 getParsedBody ()
 

Private Member Functions

 int (string $key)
 
 str (string $key)
 
 existsInPostOrQuery (string $key)
 
 getFromQueryOrPost (string $key, Transformation $transformation, string $source)
 

Private Attributes

WrapperFactory $wrapper
 
array $post
 

Detailed Description

Definition at line 28 of file GUIRequest.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\User\Profile\GUIRequest::__construct ( RequestServices  $request,
private Refinery  $refinery 
)

Definition at line 36 of file GUIRequest.php.

39 {
40 $this->wrapper = $request->wrapper();
41 $this->post = $request->request()->getParsedBody();
42 }

Member Function Documentation

◆ existsInPostOrQuery()

ILIAS\User\Profile\GUIRequest::existsInPostOrQuery ( string  $key)
private
Todo:
2023-06-05 sk: This is ugly and has to go, but right now, I have no idea, when I want to have information from $_POST or from $_GET.

Definition at line 123 of file GUIRequest.php.

123 : string
124 {
125 if ($this->wrapper->post()->has($key)) {
126 return 'post';
127 }
128
129 if ($this->wrapper->query()->has($key)) {
130 return 'query';
131 }
132
133 return '';
134 }

Referenced by ILIAS\User\Profile\GUIRequest\int(), and ILIAS\User\Profile\GUIRequest\str().

+ Here is the caller graph for this function:

◆ getBackUrl()

ILIAS\User\Profile\GUIRequest::getBackUrl ( )

Definition at line 53 of file GUIRequest.php.

53 : string
54 {
55 return $this->str('back_url');
56 }

References ILIAS\User\Profile\GUIRequest\str().

+ Here is the call graph for this function:

◆ getBaseClass()

ILIAS\User\Profile\GUIRequest::getBaseClass ( )

Definition at line 58 of file GUIRequest.php.

58 : string
59 {
60 return $this->str('baseClass');
61 }

References ILIAS\User\Profile\GUIRequest\str().

+ Here is the call graph for this function:

◆ getFieldId()

ILIAS\User\Profile\GUIRequest::getFieldId ( )

Definition at line 73 of file GUIRequest.php.

73 : string
74 {
75 return $this->str('f');
76 }

References ILIAS\User\Profile\GUIRequest\str().

+ Here is the call graph for this function:

◆ getFromQueryOrPost()

ILIAS\User\Profile\GUIRequest::getFromQueryOrPost ( string  $key,
Transformation  $transformation,
string  $source 
)
private

Definition at line 136 of file GUIRequest.php.

136 : string|int
137 {
138 if ($source === 'query') {
139 return $this->wrapper->query()->retrieve($key, $transformation);
140 }
141
142 return $this->wrapper->post()->retrieve($key, $transformation);
143 }

Referenced by ILIAS\User\Profile\GUIRequest\int(), and ILIAS\User\Profile\GUIRequest\str().

+ Here is the caller graph for this function:

◆ getOsdId()

ILIAS\User\Profile\GUIRequest::getOsdId ( )

Definition at line 68 of file GUIRequest.php.

68 : int
69 {
70 return $this->int('osd_id');
71 }

References ILIAS\User\Profile\GUIRequest\int().

+ Here is the call graph for this function:

◆ getParsedBody()

ILIAS\User\Profile\GUIRequest::getParsedBody ( )
Todo:
2023-06-05 sk: This is not what we want, but in order to avoid having a RequestInterface and a GUIRequest as class attributes

Definition at line 114 of file GUIRequest.php.

114 : array
115 {
116 return $this->post;
117 }

References ILIAS\User\Profile\GUIRequest\$post.

◆ getPrompted()

ILIAS\User\Profile\GUIRequest::getPrompted ( )

Definition at line 63 of file GUIRequest.php.

63 : int
64 {
65 return $this->int('prompted');
66 }

References ILIAS\User\Profile\GUIRequest\int().

+ Here is the call graph for this function:

◆ getTerm()

ILIAS\User\Profile\GUIRequest::getTerm ( )

Definition at line 78 of file GUIRequest.php.

78 : string
79 {
80 return $this->str('term');
81 }

References ILIAS\User\Profile\GUIRequest\str().

+ Here is the call graph for this function:

◆ getToken()

ILIAS\User\Profile\GUIRequest::getToken ( )

Definition at line 83 of file GUIRequest.php.

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

References ILIAS\User\Profile\GUIRequest\str().

+ Here is the call graph for this function:

◆ getUserId()

ILIAS\User\Profile\GUIRequest::getUserId ( )

Definition at line 44 of file GUIRequest.php.

44 : int
45 {
46 $user_id = $this->int('user_id');
47 if ($user_id !== 0) {
48 return $this->int('user_id');
49 }
50 return $this->int('user');
51 }

References $user_id, and ILIAS\User\Profile\GUIRequest\int().

+ Here is the call graph for this function:

◆ int()

ILIAS\User\Profile\GUIRequest::int ( string  $key)
private

Definition at line 88 of file GUIRequest.php.

88 : int
89 {
90 $source = $this->existsInPostOrQuery($key);
91 if ($source === '') {
92 return 0;
93 }
94
95 $transformation = $this->refinery->kindlyTo()->int();
96 return $this->getFromQueryOrPost($key, $transformation, $source);
97 }
getFromQueryOrPost(string $key, Transformation $transformation, string $source)
Definition: GUIRequest.php:136

References ILIAS\User\Profile\GUIRequest\existsInPostOrQuery(), ILIAS\User\Profile\GUIRequest\getFromQueryOrPost(), and ILIAS\Repository\refinery().

Referenced by ILIAS\User\Profile\GUIRequest\getOsdId(), ILIAS\User\Profile\GUIRequest\getPrompted(), and ILIAS\User\Profile\GUIRequest\getUserId().

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

◆ str()

ILIAS\User\Profile\GUIRequest::str ( string  $key)
private

Definition at line 99 of file GUIRequest.php.

99 : string
100 {
101 $source = $this->existsInPostOrQuery($key);
102 if ($source === '') {
103 return '';
104 }
105
106 $transformation = $this->refinery->kindlyTo()->string();
107 return $this->getFromQueryOrPost($key, $transformation, $source);
108 }

References ILIAS\User\Profile\GUIRequest\existsInPostOrQuery(), ILIAS\User\Profile\GUIRequest\getFromQueryOrPost(), and ILIAS\Repository\refinery().

Referenced by ILIAS\User\Profile\GUIRequest\getBackUrl(), ILIAS\User\Profile\GUIRequest\getBaseClass(), ILIAS\User\Profile\GUIRequest\getFieldId(), ILIAS\User\Profile\GUIRequest\getTerm(), and ILIAS\User\Profile\GUIRequest\getToken().

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

Field Documentation

◆ $post

array ILIAS\User\Profile\GUIRequest::$post
private

Definition at line 34 of file GUIRequest.php.

Referenced by ILIAS\User\Profile\GUIRequest\getParsedBody().

◆ $wrapper

WrapperFactory ILIAS\User\Profile\GUIRequest::$wrapper
private

Definition at line 30 of file GUIRequest.php.


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