Skip to content

Commit 18e0c08

Browse files
committed
Create ResponseInterface.php
1 parent aefa005 commit 18e0c08

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Интерфейс ответа.
4+
* @package evas-php\evas-http
5+
* @author Egor Vasyakin <[email protected]>
6+
*/
7+
namespace Evas\Http\Interfaces;
8+
9+
interface ResponseInterface
10+
{
11+
/**
12+
* Установка кода статуса.
13+
* @param int
14+
* @throws Exception
15+
* @return self
16+
*/
17+
public function withStatusCode(int $code);
18+
19+
/**
20+
* Установка тела.
21+
* @param string
22+
* @return self
23+
*/
24+
public function withBody(string $body);
25+
26+
/**
27+
* Установка тела с преобразованием в json.
28+
* @param mixed
29+
* @return self
30+
*/
31+
public function withBodyJson($body);
32+
33+
34+
35+
/**
36+
* Получение кода статуса.
37+
* @return int
38+
*/
39+
public function getStatusCode(): int;
40+
41+
/**
42+
* Получение тела.
43+
* @return string
44+
*/
45+
public function getBody(): string;
46+
47+
48+
49+
/**
50+
* Отправка.
51+
* @param int|null код статуса
52+
* @param string|null тело
53+
* @param array|null заголовки
54+
*/
55+
public function send(int $code = null, string $body = null, array $headers = null);
56+
57+
/**
58+
* Отправка с преобразованием тела в json.
59+
* @param int|null код статуса
60+
* @param mixed|null тело
61+
* @param array|null заголовки
62+
*/
63+
public function sendJson(int $code = null, $body = null, array $headers = null);
64+
}

0 commit comments

Comments
 (0)