Response::getViewUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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