Presentation   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 40
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResource() 0 4 1
A getStatusCode() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the FiveLab Resource package
7
 *
8
 * (c) FiveLab
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace FiveLab\Component\Resource\Presentation;
15
16
use FiveLab\Component\Resource\Resource\ResourceInterface;
17
18
/**
19
 * The default presentation for send the resource to the client.
20
 *
21
 * @author Vitaliy Zhuk <[email protected]>
22
 */
23
class Presentation implements PresentationInterface
24
{
25
    /**
26
     * @var ResourceInterface
27
     */
28
    private $resource;
29
30
    /**
31
     * @var int
32
     */
33
    private $statusCode;
34
35
    /**
36
     * Constructor.
37
     *
38
     * @param int                    $statusCode
39
     * @param ResourceInterface|null $resource
40
     */
41 40
    public function __construct(int $statusCode, ResourceInterface $resource = null)
42
    {
43 40
        $this->resource = $resource;
44 40
        $this->statusCode = $statusCode;
45 40
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 40
    public function getResource(): ?ResourceInterface
51
    {
52 40
        return $this->resource;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58 40
    public function getStatusCode(): int
59
    {
60 40
        return $this->statusCode;
61
    }
62
}
63