Completed
Push — master ( 0a059e...292010 )
by John
02:21
created

APIResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
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 29
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 getMIMEType() 0 3 1
A getAsDataStream() 0 3 1
1
<?php
2
namespace LunixREST\Server\APIResponse;
3
4
use Psr\Http\Message\StreamInterface;
5
6
/**
7
 * An immutable data class representing a response to an APIRequest generated by an RequestFactory from APIRequestData.
8
 * Class APIResponse
9
 * @package LunixREST\Server\APIResponse
10
 */
11
class APIResponse
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $MIMEType;
17
    /**
18
     * @var StreamInterface
19
     */
20
    protected $stream;
21
22 3
    public function __construct(string $MIMEType, StreamInterface $stream)
23
    {
24 3
        $this->MIMEType = $MIMEType;
25 3
        $this->stream = $stream;
26 3
    }
27
28 3
    public function getMIMEType(): string {
29 3
        return $this->MIMEType;
30
    }
31
32
    /**
33
     * @return StreamInterface
34
     */
35 3
    public function getAsDataStream(): StreamInterface {
36 3
        return $this->stream;
37
    }
38
39
}
40