1 | <?php |
||
22 | class Response implements ResponseInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | public static $codes = [ |
||
28 | 'HelpTextFollows' => 100, // RFC 3977 |
||
29 | |||
30 | 'PostingAllowed' => 200, // RFC 3977 |
||
31 | 'PostingProhibited' => 201, // RFC 3977 |
||
32 | |||
33 | 'ConnectionClosing' => 205, // rfc 3977 |
||
34 | 'GroupSelected' => 211, // rfc 3977 |
||
35 | 'InformationFollows' => 215, // rfc 2980 |
||
36 | 'ArticleFollows' => 220, //rfc 3977 |
||
37 | 'HeadFollows' => 221, //rfc 3977 Section 6.2.2 |
||
38 | 'BodyFollows' => 222, //rfc 3977 |
||
39 | 'OverviewInformationFollows' => 224, // rfc 2980 |
||
40 | 'ArticleReceived' => 240, //rfc 3977 |
||
41 | 'AuthenticationAccepted' => 281, // rfc 4643 |
||
42 | 'XfeatureEnabled' => 290, |
||
43 | |||
44 | 'SendArticle' => 340, // rfc 3977 |
||
45 | 'PasswordRequired' => 381, // rfc 4643 |
||
46 | |||
47 | 'NoSuchGroup' => 411, // rfc 3977 |
||
48 | 'NoNewsgroupCurrentSelected' => 412, // rfc 2980 |
||
49 | 'NoArticlesSelected' => 420, // rfc 2980 |
||
50 | 'NoSuchArticleNumber' => 423, // rfc 3977 |
||
51 | 'NoSuchArticleId' => 430, // rfc 3977 |
||
52 | 'PostingNotPermitted' => 440, // rfc 3977 |
||
53 | 'PostingFailed' => 441, // rfc 3977 |
||
54 | 'AuthenticationRejected' => 481, // rfc 4643 |
||
55 | 'AuthenticationOutOfSequence' => 482, // rfc 4643 |
||
56 | |||
57 | 'CommandUnknown' => 500, // rfc 3977 |
||
58 | 'InvalidKeyword' => 501, // rfc 3977 |
||
59 | 'CommandUnavailable' => 502, // rfc 4643 |
||
60 | 'ProgramError' => 503, // rfc 2980 |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | private $message; |
||
67 | |||
68 | /** |
||
69 | * @var int |
||
70 | */ |
||
71 | private $statusCode; |
||
72 | |||
73 | /** |
||
74 | * @param string $response |
||
75 | */ |
||
76 | 9 | public static function createFromString($response) |
|
99 | |||
100 | /** |
||
101 | * Constructor. |
||
102 | * |
||
103 | * @param int $statusCode |
||
104 | * @param string $message |
||
105 | */ |
||
106 | 6 | public function __construct($statusCode, $message) |
|
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 3 | public function getMessage() |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | 4 | public function getStatusCode() |
|
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | 2 | public function __toString() |
|
135 | } |
||
136 |