Total Complexity | 5 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class RequestApi extends Core |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * RequestApi constructor. |
||
16 | * @param string $apiUrl |
||
17 | */ |
||
18 | public function __construct(string $apiUrl) |
||
19 | { |
||
20 | parent::__construct($apiUrl); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @param array $fields |
||
25 | * @param string $endpoint |
||
26 | * @return RequestApi |
||
27 | */ |
||
28 | public function post(array $fields, string $endpoint = ""): RequestApi |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param array $fields |
||
41 | * @param string $endpoint |
||
42 | * @return RequestApi |
||
43 | */ |
||
44 | public function get(array $fields, string $endpoint = ""): RequestApi |
||
45 | { |
||
46 | $this->request( |
||
47 | "GET", |
||
48 | $endpoint, |
||
49 | $fields |
||
50 | ); |
||
51 | |||
52 | return $this; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param array $fields |
||
57 | * @param string $endpoint |
||
58 | * @return RequestApi |
||
59 | */ |
||
60 | public function put(array $fields, string $endpoint = ""): RequestApi |
||
61 | { |
||
62 | $this->request( |
||
63 | "PUT", |
||
64 | $endpoint, |
||
65 | $fields |
||
66 | ); |
||
67 | |||
68 | return $this; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @param array $fields |
||
73 | * @param string $endpoint |
||
74 | * @return RequestApi |
||
75 | */ |
||
76 | public function delete(array $fields, string $endpoint = ""): RequestApi |
||
85 | } |
||
86 | } |