Passed
Push — main ( 6bf038...55787e )
by Aleksandr
08:10
created

SimpleResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 57
ccs 13
cts 13
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setHttpCode() 0 4 1
A getHttpBody() 0 3 1
A getHttpCode() 0 3 1
A setHttpBody() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Responses;
6
7
/**
8
 * Класс для ответов типа stream, например для сохранения акта в формате pdf
9
 */
10
class SimpleResponse implements ResponseInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    private string $httpBody;
16
    /**
17
     * @var int
18
     */
19
    private int $httpCode;
20
21
    /**
22
     * @param string $httpBody
23
     * @param int    $httpCode
24
     */
25 4
    public function __construct(string $httpBody, int $httpCode)
26
    {
27 4
        $this->httpBody = $httpBody;
28 4
        $this->httpCode = $httpCode;
29
    }
30
31
    /**
32
     * @return string
33
     */
34 3
    public function getHttpBody(): string
35
    {
36 3
        return $this->httpBody;
37
    }
38
39
    /**
40
     * @param string $httpBody
41
     *
42
     * @return SimpleResponse
43
     */
44 1
    public function setHttpBody(string $httpBody): SimpleResponse
45
    {
46 1
        $this->httpBody = $httpBody;
47 1
        return $this;
48
    }
49
50
    /**
51
     * @return int
52
     */
53 2
    public function getHttpCode(): int
54
    {
55 2
        return $this->httpCode;
56
    }
57
58
    /**
59
     * @param int $httpCode
60
     *
61
     * @return SimpleResponse
62
     */
63 1
    public function setHttpCode(int $httpCode): SimpleResponse
64
    {
65 1
        $this->httpCode = $httpCode;
66 1
        return $this;
67
    }
68
}
69