ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
RawHTTPServices.php
Go to the documentation of this file.
1 <?php
2 
19 namespace ILIAS\HTTP;
20 
30 
37 {
39  private ?ResponseInterface $response = null;
40 
41 
48  public function __construct(private ResponseSenderStrategy $sender, private CookieJarFactory $cookieJarFactory, private RequestFactory $requestFactory, private ResponseFactory $responseFactory, private DurationFactory $durationFactory)
49  {
50  }
51 
52  public function durations(): DurationFactory
53  {
54  return $this->durationFactory;
55  }
56 
57  public function wrapper(): WrapperFactory
58  {
59  return new WrapperFactory($this->request());
60  }
61 
62 
66  public function cookieJar(): CookieJar
67  {
68  return $this->cookieJarFactory->fromResponse($this->response());
69  }
70 
71 
75  public function request(): ServerRequestInterface
76  {
77  if ($this->request === null) {
78  $this->request = $this->requestFactory->create();
79  }
80 
81  return $this->request;
82  }
83 
84 
88  public function response(): ResponseInterface
89  {
90  if ($this->response === null) {
91  $this->response = $this->responseFactory->create();
92  }
93 
94  return $this->response;
95  }
96 
97 
101  public function saveRequest(ServerRequestInterface $request): void
102  {
103  $this->request = $request;
104  }
105 
106 
110  public function saveResponse(ResponseInterface $response): void
111  {
112  $this->response = $response;
113  }
114 
115 
119  public function sendResponse(): void
120  {
121  // Render Cookies to the response.
122  $response = $this->response();
123  $response = $this->cookieJar()->renderIntoResponseHeader($response);
124 
125  $this->sender->sendResponse($response);
126  }
127 
128 
129  public function close(): void
130  {
131  exit;
132  }
133 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(private ResponseSenderStrategy $sender, private CookieJarFactory $cookieJarFactory, private RequestFactory $requestFactory, private ResponseFactory $responseFactory, private DurationFactory $durationFactory)
RawHTTPServices constructor.
saveRequest(ServerRequestInterface $request)
ResponseInterface $response
ServerRequestInterface $request
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
saveResponse(ResponseInterface $response)
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides an interface to the ILIAS HTTP services.