Passed
Push — master ( f8044c...6aa085 )
by Alexander
03:26
created

StatusCodeDecorator::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 6
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Flugg\Responder\Http\Responses\Decorators;
4
5
use Illuminate\Http\JsonResponse;
6
7
/**
8
 * A decorator class for adding status code information to the response data.
9
 *
10
 * @package flugger/laravel-responder
11
 * @author  Alexander Tømmerås <[email protected]>
12
 * @license The MIT License
13
 */
14 View Code Duplication
class StatusCodeDecorator extends ResponseDecorator
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * Generate a JSON response.
18
     *
19
     * @param  array $data
20
     * @param  int   $status
21
     * @param  array $headers
22
     * @return \Illuminate\Http\JsonResponse
23
     */
24 1
    public function make(array $data, int $status, array $headers = []): JsonResponse
25
    {
26 1
        return $this->factory->make(array_merge([
27 1
            'status' => $status,
28
        ], $data), $status, $headers);
29
    }
30
}
31