ILIAS  trunk Revision v12.0_alpha-1613-gae4c99ebb18
ILIAS\BookingManager\Common\HttpService Class Reference
+ Collaboration diagram for ILIAS\BookingManager\Common\HttpService:

Public Member Functions

 __construct (private readonly IliasHttpServices $http, private readonly Refinery $refinery)
 
 getRequest ()
 
 getRefId ()
 
 resolveRowParameter (string $key)
 
 resolveRowParameters (string $key)
 
 get (string $key, Transformation $t)
 
 sendAsync (mixed $response)
 
 has (string $key)
 

Data Fields

const string KEY_REF_ID = 'ref_id'
 
const string ALL_OBJECTS = 'ALL_OBJECTS'
 

Detailed Description

Definition at line 30 of file HttpService.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\Common\HttpService::__construct ( private readonly IliasHttpServices  $http,
private readonly Refinery  $refinery 
)

Definition at line 36 of file HttpService.php.

39 {
40 }

Member Function Documentation

◆ get()

ILIAS\BookingManager\Common\HttpService::get ( string  $key,
Transformation  $t 
)

Definition at line 73 of file HttpService.php.

73 : mixed
74 {
75 $wrapper = $this->http->wrapper();
76
77 return match(true) {
78 $wrapper->post()->has($key) => $wrapper->post()->retrieve($key, $t),
79 $wrapper->query()->has($key) => $wrapper->query()->retrieve($key, $t),
80 default => null,
81 };
82 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getRefId()

ILIAS\BookingManager\Common\HttpService::getRefId ( )

Definition at line 47 of file HttpService.php.

47 : int
48 {
49 return $this->get(self::KEY_REF_ID, $this->refinery->kindlyTo()->int());
50 }

References ILIAS\BookingManager\Common\HttpService\KEY_REF_ID, and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getRequest()

ILIAS\BookingManager\Common\HttpService::getRequest ( )

Definition at line 42 of file HttpService.php.

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

References ILIAS\FileDelivery\http().

Referenced by ILIAS\UI\Implementation\Component\Table\Ordering\applyViewControls(), and ILIAS\UI\Implementation\Component\Table\Ordering\getData().

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

◆ has()

ILIAS\BookingManager\Common\HttpService::has ( string  $key)

Definition at line 100 of file HttpService.php.

100 : bool
101 {
102 return $this->http->wrapper()->query()->has($key) || $this->http->wrapper()->post()->has($key);
103 }

References ILIAS\FileDelivery\http().

Referenced by ilMailSearchObjectsTableGUI\__construct(), ilSessionStatisticsGUI\__construct(), ILIAS\GlobalScreen\GUI\Access\Access\__construct(), ILIAS\StaticURL\Request\LegacyRequestBuilder\buildRequest(), ILIAS\StaticURL\Request\StaticURLRequestBuilder\buildRequest(), ilDclTableView\createOrGetStandardView(), ilMailForm\getRecipientAsync(), and ilMembershipNotifications\importFromForm().

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

◆ resolveRowParameter()

ILIAS\BookingManager\Common\HttpService::resolveRowParameter ( string  $key)

Definition at line 52 of file HttpService.php.

52 : string|int
53 {
54 return $this->get($key, $this->refinery->byTrying([
55 $this->refinery->kindlyTo()->int(),
56 $this->refinery->kindlyTo()->string(),
57 $this->refinery->custom()->transformation(static fn(array $value): string|int => $value[0])
58 ]));
59 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ resolveRowParameters()

ILIAS\BookingManager\Common\HttpService::resolveRowParameters ( string  $key)

Definition at line 61 of file HttpService.php.

61 : array|string
62 {
63 return $this->get($key, $this->refinery->custom()->transformation(
64 static fn(array|string $value): array|string => $value === self::ALL_OBJECTS || $value[0] === self::ALL_OBJECTS
65 ? self::ALL_OBJECTS
66 : array_map(
67 static fn(string $value): string|int => count(explode('_', $value)) > 1 ? $value : (int) $value,
68 $value
69 )
70 )) ?? [];
71 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ sendAsync()

ILIAS\BookingManager\Common\HttpService::sendAsync ( mixed  $response)
Parameters
Stream | string | mixed$response

Definition at line 87 of file HttpService.php.

87 : void
88 {
89 $response = match(true) {
92 default => $response,
93 };
94
95 $this->http->saveResponse($this->http->response()->withBody($response));
96 $this->http->sendResponse();
97 $this->http->close();
98 }
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
Definition: Streams.php:64
$response
Definition: xapitoken.php:90

References $response, ILIAS\FileDelivery\http(), ILIAS\Filesystem\Stream\Streams\ofResource(), and ILIAS\Filesystem\Stream\Streams\ofString().

+ Here is the call graph for this function:

Field Documentation

◆ ALL_OBJECTS

const string ILIAS\BookingManager\Common\HttpService::ALL_OBJECTS = 'ALL_OBJECTS'

Definition at line 34 of file HttpService.php.

◆ KEY_REF_ID

const string ILIAS\BookingManager\Common\HttpService::KEY_REF_ID = 'ref_id'

Definition at line 32 of file HttpService.php.

Referenced by ILIAS\BookingManager\Common\HttpService\getRefId().


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