Completed
Push — master ( 6ae77b...70b3ca )
by Artem
01:23
created

ExceptionResponseFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createJsonResponse() 0 4 1
1
<?php
2
/*
3
 * This file is part of the StfalconApiBundle.
4
 *
5
 * (c) Stfalcon LLC <stfalcon.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace StfalconStudio\ApiBundle\Service\Exception;
14
15
use Symfony\Component\HttpFoundation\JsonResponse;
16
17
/**
18
 * ExceptionResponseFactory.
19
 */
20
class ExceptionResponseFactory
21
{
22
    /**
23
     * @param string $json
24
     * @param int    $statusCode
25
     *
26
     * @return JsonResponse
27
     */
28
    public function createJsonResponse(string $json, int $statusCode): JsonResponse
29
    {
30
        return (new JsonResponse($json, $statusCode, [], true))->setEncodingOptions(\JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
31
    }
32
}
33