Passed
Branch release (695ec7)
by Henry
04:31
created

ResponseBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
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
namespace Divergence\Responders;
11
12
use Psr\Http\Message\StreamInterface;
13
14
abstract class ResponseBuilder
15
{
16
    protected $template;
17
    protected string $contentType = '';
18
    protected array $headers;
19
    protected array $data;
20
21
    public function __construct($template, $data = [], $headers = [])
22
    {
23
        $this->template = $template;
24
        $this->data = $data;
25
        $this->headers = $headers;
26
    }
27
28
    public function getHeaders(): array
29
    {
30
        return $this->headers;
31
    }
32
33
34
    public function getContentType(): string
35
    {
36
        return $this->contentType;
37
    }
38
39
    abstract public function getBody(): StreamInterface;
40
}
41