View   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 8
dl 0
loc 45
ccs 16
cts 16
cp 1
rs 10
c 2
b 1
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setHeader() 0 3 1
A setParameter() 0 3 1
A getTemplate() 0 3 1
A getParameters() 0 3 1
A getStatusCode() 0 3 1
A getContentType() 0 3 1
A __construct() 0 8 1
A getHeaders() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace jschreuder\Middle\View;
4
5
final class View implements ViewInterface
6
{
7 3
    public function __construct(
8
        private string $template,
9
        private array $parameters = [],
10
        private int $statusCode = 200,
11
        private string $contentType = self::CONTENT_TYPE_HTML,
12
        private array $headers = []
13
    )
14
    {
15 3
    }
16
17 2
    public function getStatusCode(): int
18
    {
19 2
        return $this->statusCode;
20
    }
21
22 3
    public function getHeaders(): array
23
    {
24 3
        return $this->headers;
25
    }
26
27 1
    public function setHeader(string $key, string $value): void
28
    {
29 1
        $this->headers[$key] = $value;
30
    }
31
32 2
    public function getContentType(): string
33
    {
34 2
        return $this->contentType;
35
    }
36
37 2
    public function getTemplate(): string
38
    {
39 2
        return $this->template;
40
    }
41
42 3
    public function getParameters(): array
43
    {
44 3
        return $this->parameters;
45
    }
46
47 1
    public function setParameter(string $key, $value): void
48
    {
49 1
        $this->parameters[$key] = $value;
50
    }
51
}
52