Completed
Push — master ( 9c5fdf...27a5d2 )
by John
7s
created

VndErrorResponse   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\Response\ErrorResponseFactory\VndError;
10
11
use Ramsey\VndError\VndError;
12
use Symfony\Component\HttpFoundation\JsonResponse;
13
use Symfony\Component\HttpFoundation\Response;
14
15
/**
16
 * @author John Kleijn <[email protected]>
17
 */
18
class VndErrorResponse extends JsonResponse
19
{
20
    const DEFAULT_STATUS = Response::HTTP_INTERNAL_SERVER_ERROR;
21
22
    /**
23
     * @param VndError $vndError
24
     * @param int      $status
25
     * @param array    $headers
26
     */
27
    public function __construct(VndError $vndError, $status = self::DEFAULT_STATUS, array $headers = [])
28
    {
29
        $headers = array_merge(['Content-Type' => 'application/vnd.error+json'], $headers);
30
        parent::__construct($vndError->asJson(false, false), $status, $headers);
31
    }
32
}
33