Total Complexity | 6 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class HttpClient |
||
6 | { |
||
7 | public $http = []; |
||
8 | |||
9 | public $assertion; |
||
10 | |||
11 | public $app; |
||
12 | |||
13 | public $event; |
||
14 | |||
15 | public $exception; |
||
16 | |||
17 | /** |
||
18 | * HttpClient constructor. |
||
19 | * |
||
20 | * @param $app |
||
21 | */ |
||
22 | public function __construct($app) |
||
23 | { |
||
24 | $this->app = $app; |
||
25 | } |
||
26 | |||
27 | public function sendingPostRequest($url, $data = []): IsRespondedWith |
||
28 | { |
||
29 | $this->http = [ |
||
30 | 'method' => 'post', |
||
31 | 'url' => $url, |
||
32 | 'data' => $data |
||
33 | ]; |
||
34 | |||
35 | return new IsRespondedWith($this); |
||
36 | } |
||
37 | |||
38 | public function sendingGetRequest($url): IsRespondedWith |
||
39 | { |
||
40 | $this->http = [ |
||
41 | 'method' => 'get', |
||
42 | 'url' => $url, |
||
43 | 'data' => [], |
||
44 | ]; |
||
45 | |||
46 | return new IsRespondedWith($this); |
||
47 | } |
||
48 | |||
49 | public function exceptionIsThrown($type) |
||
50 | { |
||
51 | $this->exception = $type; |
||
52 | } |
||
53 | |||
54 | public function whenEventHappens($event) |
||
58 | } |
||
59 | |||
60 | public function __destruct() |
||
63 | } |
||
64 | } |