ResponseDecorator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
make() 0 1 ?
A __construct() 0 4 1
1
<?php
2
3
namespace Flugg\Responder\Http\Responses\Decorators;
4
5
use Flugg\Responder\Contracts\ResponseFactory;
6
use Illuminate\Http\JsonResponse;
7
8
/**
9
 * A decorator class for decorating responses.
10
 *
11
 * @package flugger/laravel-responder
12
 * @author  Alexander Tømmerås <[email protected]>
13
 * @license The MIT License
14
 */
15
abstract class ResponseDecorator implements ResponseFactory
16
{
17
    /**
18
     * The factory being decorated.
19
     *
20
     * @var \Flugg\Responder\Contracts\ResponseFactory
21
     */
22
    protected $factory;
23
24
    /**
25
     * Construct the decorator class.
26
     *
27
     * @param \Flugg\Responder\Contracts\ResponseFactory $factory
28
     */
29 59
    public function __construct(ResponseFactory $factory)
30
    {
31 59
        $this->factory = $factory;
32 59
    }
33
34
    /**
35
     * Generate a JSON response.
36
     *
37
     * @param  array $data
38
     * @param  int   $status
39
     * @param  array $headers
40
     * @return \Illuminate\Http\JsonResponse
41
     */
42
    abstract public function make(array $data, int $status, array $headers = []): JsonResponse;
43
}
44