ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
Async.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\HTTP\Services as HttpService;
26use ILIAS\UI\Component\Modal\Interruptive as InterruptiveModal;
27use ILIAS\UI\Component\Modal\RoundTrip as RoundTripModal;
29use ILIAS\UI\Renderer as UIRenderer;
30
31class Async
32{
33 public function __construct(
34 private readonly HttpService $http,
35 private readonly InterruptiveModal|RoundTripModal|MessageBox|State|array|string $content
36 ) {
37 }
38
39 public function render(
40 UIRenderer $ui_renderer
41 ): void {
42 $rendered_content = is_string($this->content)
43 ? $this->content
44 : $ui_renderer->renderAsync($this->content);
45
46 $this->http->saveResponse(
47 $this->http->response()->withBody(
49 $rendered_content
50 )
51 )
52 );
53 $this->http->sendResponse();
54 $this->http->close();
55 }
56}
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
Class Services.
Definition: Services.php:43
__construct(private readonly HttpService $http, private readonly InterruptiveModal|RoundTripModal|MessageBox|State|array|string $content)
Definition: Async.php:33
render(UIRenderer $ui_renderer)
Definition: Async.php:39
An entity that renders components to a string output.
Definition: Renderer.php:31
static http()
Fetches the global http state from ILIAS.