ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.Response.php
Go to the documentation of this file.
1<?php
2
20
25{
29 protected $data = [];
30
31 protected \ILIAS\HTTP\Services $http;
32
36 public function __construct($data)
37 {
38 global $DIC;
39
40 $this->http = $DIC->http();
41 $this->data = $data;
42 }
43
44 public function send(): void
45 {
47
48 $string = json_encode($this->data);
50 $http->saveResponse($http
51 ->response()
52 ->withAddedHeader('Content-Type', 'application/json')
53 ->withBody($stream));
54 $http->sendResponse();
55 $http->close();
56 }
57}
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