]> git.mxchange.org Git - friendica.git/blob - src/Network/HTTPClient/Capability/ICanHandleHttpResponses.php
Update function / rearrange tab order
[friendica.git] / src / Network / HTTPClient / Capability / ICanHandleHttpResponses.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2023, the Friendica project
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 namespace Friendica\Network\HTTPClient\Capability;
23
24 use Psr\Http\Message\MessageInterface;
25
26 /**
27  * Temporary class to map Friendica used variables based on PSR-7 HTTPResponse
28  */
29 interface ICanHandleHttpResponses
30 {
31         /**
32          * Gets the Return Code
33          *
34          * @return string The Return Code
35          */
36         public function getReturnCode(): string;
37
38         /**
39          * Returns the Content Type
40          *
41          * @return string the Content Type
42          */
43         public function getContentType(): string;
44
45         /**
46          * Returns the headers
47          *
48          * @param string $header optional header field. Return all fields if empty
49          *
50          * @return string[] the headers or the specified content of the header variable
51          *@see MessageInterface::getHeader()
52          *
53          */
54         public function getHeader(string $header);
55
56         /**
57          * Returns all headers
58          *
59          * @see MessageInterface::getHeaders()
60          * @return string[][]
61          */
62         public function getHeaders();
63
64         /**
65          * Check if a specified header exists
66          *
67          * @see MessageInterface::hasHeader()
68          * @param string $field header field
69          * @return boolean "true" if header exists
70          */
71         public function inHeader(string $field): bool;
72
73         /**
74          * Returns the headers as an associated array
75          * @see MessageInterface::getHeaders()
76          * @deprecated
77          *
78          * @return string[][] associated header array
79          */
80         public function getHeaderArray();
81
82         /**
83          * @return bool
84          */
85         public function isSuccess(): bool;
86
87         /**
88          * @return string
89          */
90         public function getUrl(): string;
91
92         /**
93          * @return string
94          */
95         public function getRedirectUrl(): string;
96
97         /**
98          * Getter for body
99          *
100          * @see MessageInterface::getBody()
101          * @return string
102          */
103         public function getBody();
104
105         /**
106          * @return boolean
107          */
108         public function isRedirectUrl(): bool;
109
110         /**
111          * @return integer
112          */
113         public function getErrorNumber(): int;
114
115         /**
116          * @return string
117          */
118         public function getError(): string;
119
120         /**
121          * @return boolean
122          */
123         public function isTimeout(): bool;
124 }