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

StatusCodeDecorator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 17
loc 17
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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