1 | <?php |
||
12 | final class Reply |
||
13 | { |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | private $lines = []; |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | private $codes = []; |
||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $messages = []; |
||
26 | /** |
||
27 | * @var Client |
||
28 | */ |
||
29 | private $client; |
||
30 | |||
31 | /** |
||
32 | * Reply constructor. |
||
33 | * @param Client $client |
||
34 | */ |
||
35 | 23 | public function __construct(Client $client) |
|
39 | |||
40 | /** |
||
41 | * @return bool |
||
42 | */ |
||
43 | 6 | public function isError(): bool |
|
52 | |||
53 | /** |
||
54 | * @return array |
||
55 | */ |
||
56 | 13 | public function getMessages(): array |
|
60 | |||
61 | /** |
||
62 | * @param int $code |
||
63 | * @param string $message |
||
64 | * @return Reply |
||
65 | */ |
||
66 | 23 | public function withLine(int $code, string $message): Reply |
|
74 | |||
75 | /** |
||
76 | * @param int $code |
||
77 | * @return Client |
||
78 | */ |
||
79 | 1 | public function assert(int $code): Client { |
|
82 | |||
83 | /** |
||
84 | * @return Client |
||
85 | */ |
||
86 | 13 | public function assertCompleted(): Client { |
|
89 | |||
90 | /** |
||
91 | * @return Client |
||
92 | */ |
||
93 | 6 | public function assertIntermediate(): Client { |
|
96 | |||
97 | /** |
||
98 | * @param int $min |
||
99 | * @param int $max |
||
100 | * @return Client |
||
101 | * @throws AssertionFailedException |
||
102 | */ |
||
103 | 18 | private function assertBetween(int $min, int $max): Client |
|
120 | |||
121 | /** |
||
122 | * @return string |
||
123 | */ |
||
124 | 5 | private function createErrorMessage(): string |
|
136 | } |