Response   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 28
ccs 8
cts 13
cp 0.6153
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDomainCommand() 0 9 2
A getViewUrl() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace WebPresentation\ApplicationController;
6
7
use ReflectionClass;
8
use ReflectionException;
9
use Exception\ApplicationException;
10
11
class Response
12
{
13
    private ReflectionClass $domainCommand;
14
15
    private string $viewUrl;
16
17 2
    public function __construct(string $domainCommand, string $viewUrl)
18
    {
19 2
        $this->domainCommand = new ReflectionClass($domainCommand);
20 2
        $this->viewUrl = $viewUrl;
21 2
    }
22
23 2
    public function getDomainCommand(): DomainCommand
24
    {
25
        try {
26 2
            return $this->domainCommand->newInstance();
27
        } catch (ReflectionException $e) {
28
            throw new ApplicationException(
29
                $e->getMessage(),
30
                $e->getCode(),
31
                $e
32
            );
33
        }
34
    }
35
36 2
    public function getViewUrl(): string
37
    {
38 2
        return $this->viewUrl;
39
    }
40
}
41