ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
Services.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\HTTP;
22
27use Psr\Http\Message\ResponseInterface;
28use Psr\Http\Message\ServerRequestInterface;
35
42class Services implements GlobalHttpState
43{
45 protected ?WrapperFactory $wrapper = null;
47
51 public function __construct(
52 RequestFactory $request_factory,
53 ResponseFactory $response_factory,
54 CookieJarFactory $cookie_jar,
55 ResponseSenderStrategy $response_sender_strategy,
56 DurationFactory $duration_factory,
57 CookieFactory $cookie_factory,
58 MessageFactory $message_factory,
59 ) {
60 $this->raw = new RawHTTPServices(
61 $response_sender_strategy,
62 $cookie_jar,
63 $request_factory,
64 $response_factory,
65 $duration_factory,
66 $cookie_factory,
67 $message_factory
68 );
69 $this->agent = new AgentDetermination();
70 }
71
72 public function sender(): ResponseSenderStrategy
73 {
74 return $this->raw()->sender();
75 }
76
77 public function durations(): DurationFactory
78 {
79 return $this->raw->durations();
80 }
81
82 public function messages(): MessageFactory
83 {
84 return $this->raw->messages();
85 }
86
87 public function wrapper(): WrapperFactory
88 {
89 return $this->wrapper ?? $this->wrapper = new WrapperFactory($this->raw->request());
90 }
91
96 public function raw(): RawHTTPServices
97 {
98 return $this->raw;
99 }
100
106 public function request(): ServerRequestInterface
107 {
108 return $this->raw()->request();
109 }
110
116 public function response(): ResponseInterface
117 {
118 return $this->raw()->response();
119 }
120
126 public function cookies(): CookieFactory
127 {
128 return $this->raw->cookies();
129 }
130
131 public function cookieJar(): CookieJar
132 {
133 return $this->raw()->cookieJar();
134 }
135
139 public function saveRequest(ServerRequestInterface $request): void
140 {
141 $this->raw()->saveRequest($request);
142 }
143
147 public function saveResponse(ResponseInterface $response): void
148 {
149 $this->raw()->saveResponse($response);
150 }
151
155 public function sendResponse(): void
156 {
157 $this->raw()->sendResponse();
158 }
159
160 public function close(): never
161 {
162 $this->raw()->close();
163 }
164
165 public function agent(): AgentDetermination
166 {
167 return $this->agent;
168 }
169}
This library is borrowed from the phpGroupWare API http://www.phpgroupware.org/api Modifications made...
Provides an interface to the ILIAS HTTP services.
Class Services.
Definition: Services.php:43
GlobalHttpState $raw
Definition: Services.php:44
WrapperFactory $wrapper
Definition: Services.php:45
__construct(RequestFactory $request_factory, ResponseFactory $response_factory, CookieJarFactory $cookie_jar, ResponseSenderStrategy $response_sender_strategy, DurationFactory $duration_factory, CookieFactory $cookie_factory, MessageFactory $message_factory,)
Services constructor.
Definition: Services.php:51
cookieJar()
Returns a cookie jar which has all cookies known by the ILIAS response.
Definition: Services.php:131
AgentDetermination $agent
Definition: Services.php:46
saveResponse(ResponseInterface $response)
@inheritDoc
Definition: Services.php:147
sendResponse()
@inheritDoc
Definition: Services.php:155
saveRequest(ServerRequestInterface $request)
@inheritDoc
Definition: Services.php:139
Interface GlobalHttpState.
Creates psr-7 messages without binding components to the underlying library.
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
Definition: ltiauth.php:39
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$response
Definition: xapitoken.php:92