FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ResponseHelper.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2021 Siemens AG
4  Author: Gaurav Mishra <mishra.gaurav@siemens.com>
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
13 namespace Fossology\UI\Api\Helper;
14 
15 use Slim\Psr7\Response;
16 
21 class ResponseHelper extends Response
22 {
29  public function withJson($arr, int $stat=200)
30  {
31  $this->getBody()->write(json_encode($arr));
32  return $this->withHeader("Content-Type", "application/json")
33  ->withStatus($stat);
34  }
35 }
Override Slim response for withJson function.
REST api helper classes.