FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ResponseFactoryHelper.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 
14 namespace Fossology\UI\Api\Helper;
15 
16 use Psr\Http\Message\ResponseInterface;
17 use Slim\Psr7\Factory\ResponseFactory;
18 
23 class ResponseFactoryHelper extends ResponseFactory
24 {
28  public function createResponse(
29  int $code = 200,
30  string $reasonPhrase = ''
31  ): ResponseInterface
32  {
33  $res = new ResponseHelper($code);
34 
35  if ($reasonPhrase !== '') {
36  $res = $res->withStatus($code, $reasonPhrase);
37  }
38 
39  return $res;
40  }
41 }
Override Slim response factory for custom response.
createResponse(int $code=200, string $reasonPhrase='')
Override Slim response for withJson function.
REST api helper classes.