ResponseBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
ccs 6
cts 8
cp 0.75
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHeaders() 0 3 1
A getContentType() 0 3 1
1
<?php
2
/**
3
 * This file is part of the Divergence package.
4
 *
5
 * (c) Henry Paradiz <[email protected]>
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
namespace Divergence\Responders;
12
13
use Psr\Http\Message\StreamInterface;
14
15
abstract class ResponseBuilder
16
{
17
    protected $template;
18
    protected string $contentType = '';
19
    protected array $headers;
20
    protected array $data;
21
22 69
    public function __construct($template, $data = [], $headers = [])
23
    {
24 69
        $this->template = $template;
25 69
        $this->data = $data;
26 69
        $this->headers = $headers;
27
    }
28
29
    public function getHeaders(): array
30
    {
31
        return $this->headers;
32
    }
33
34
35 65
    public function getContentType(): string
36
    {
37 65
        return $this->contentType;
38
    }
39
40
    abstract public function getBody(): StreamInterface;
41
}
42