ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HTTPServices.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
4namespace ILIAS\DI;
5
13
20{
21
25 private $sender;
41 private $request;
45 private $response;
46
47
57 {
58 $this->sender = $senderStrategy;
59 $this->cookieJarFactory = $cookieJarFactory;
60
61 $this->requestFactory = $requestFactory;
62 $this->responseFactory = $responseFactory;
63 }
64
65
71 public function cookieJar()
72 {
73 return $this->cookieJarFactory->fromResponse($this->response());
74 }
75
76
80 public function request()
81 {
82 if ($this->request === null) {
83 $this->request = $this->requestFactory->create();
84 }
85
86 return $this->request;
87 }
88
89
93 public function response()
94 {
95 if ($this->response === null) {
96 $this->response = $this->responseFactory->create();
97 }
98
99 return $this->response;
100 }
101
102
107 {
108 $this->request = $request;
109 }
110
111
116 {
117 $this->response = $response;
118 }
119
120
124 public function sendResponse()
125 {
126 $this->sender->sendResponse($this->response());
127 }
128}
An exception for terminatinating execution or to throw for unit testing.
Provides an interface to the ILIAS HTTP services.
__construct(ResponseSenderStrategy $senderStrategy, CookieJarFactory $cookieJarFactory, RequestFactory $requestFactory, ResponseFactory $responseFactory)
HTTPServices constructor.
sendResponse()
@inheritDoc
request()
@inheritDoc
cookieJar()
Creates a new cookie jar from the current known request.
saveRequest(ServerRequestInterface $request)
@inheritDoc
response()
@inheritDoc
saveResponse(ResponseInterface $response)
@inheritDoc
Interface GlobalHttpState.
Representation of an outgoing, server-side response.
Representation of an incoming, server-side HTTP request.
Class HTTPServicesTest.