@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | class Request |
8 | 8 | { |
9 | - public function __construct($url, $query = NULL, $header = [], $body = "") |
|
9 | + public function __construct($url, $query = NULL, $header = [ ], $body = "") |
|
10 | 10 | { |
11 | 11 | $this->url = $url; |
12 | 12 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | try { |
23 | 23 | $send = (new Client())->get($this->url, $this->config); |
24 | 24 | return $send->getBody()->getContents(); |
25 | - }catch(ClientException $e){ |
|
25 | + }catch (ClientException $e) { |
|
26 | 26 | $this->error = $e; |
27 | 27 | return false; |
28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $send = (new Client())->post($this->url, $this->config); |
36 | 36 | return $send->getBody()->getContents(); |
37 | - }catch(ClientException $e){ |
|
37 | + }catch (ClientException $e) { |
|
38 | 38 | $this->error = $e; |
39 | 39 | return false; |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | try { |
46 | 46 | $send = (new Client())->put($this->url, $this->config); |
47 | 47 | return $send->getBody()->getContents(); |
48 | - }catch(ClientException $e){ |
|
48 | + }catch (ClientException $e) { |
|
49 | 49 | $this->error = $e; |
50 | 50 | return false; |
51 | 51 | } |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | try { |
57 | 57 | $send = (new Client())->delete($this->url, $this->config); |
58 | 58 | return $send->getBody()->getContents(); |
59 | - }catch(ClientException $e){ |
|
59 | + }catch (ClientException $e) { |
|
60 | 60 | $this->error = $e; |
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - public function fail($show=true) |
|
65 | + public function fail($show = true) |
|
66 | 66 | { |
67 | - if($show==true){ |
|
67 | + if ($show==true) { |
|
68 | 68 | header('Cache-Control: no-cache, must-revalidate'); |
69 | 69 | header('Content-Type: application/json'); |
70 | 70 | |
71 | 71 | http_response_code($this->error->getCode()); |
72 | 72 | echo $this->error->getResponse()->getBody(); |
73 | 73 | exit(); |
74 | - }else{ |
|
74 | + }else { |
|
75 | 75 | return $this->error->getResponse()->getBody(); |
76 | 76 | } |
77 | 77 | } |