ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.Response.php
Go to the documentation of this file.
1<?php
2
20
22{
23 protected array|\stdClass $data = [];
24
25 protected \ILIAS\HTTP\Services $http;
26
30 public function __construct(array|\stdClass $data)
31 {
32 global $DIC;
33
34 $this->http = $DIC->http();
35 $this->data = $data;
36 }
37
38 public function send(): void
39 {
41
42 $string = json_encode($this->data);
44 $http->saveResponse($http
45 ->response()
46 ->withAddedHeader('Content-Type', 'application/json')
47 ->withBody($stream));
48 $http->sendResponse();
49 $http->close();
50 }
51}
__construct(array|\stdClass $data)
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26