ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ResponseHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Test;
22
25use ILIAS\HTTP\Services as HttpService;
26
28{
29 public function __construct(
30 private readonly HttpService $http,
31 ) {
32 }
33
37 public function sendAsync(mixed $response): void
38 {
39 if (is_string($response)) {
41 } elseif (is_resource($response)) {
43 }
44
45 $this->http->saveResponse(
46 $this->http->response()->withBody($response)
47 );
48 $this->http->sendResponse();
49 $this->http->close();
50 }
51}
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Definition: Streams.php:32
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
Class Services.
Definition: Services.php:38
__construct(private readonly HttpService $http,)
$http
Definition: deliver.php:30
static http()
Fetches the global http state from ILIAS.
$response
Definition: xapitoken.php:93