@@ -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,19 +56,19 @@ 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 | http_response_code($this->error->getCode()); |
| 69 | 69 | echo $this->error->getResponse()->getBody(); |
| 70 | 70 | exit(); |
| 71 | - }else{ |
|
| 71 | + }else { |
|
| 72 | 72 | return $this->error->getResponse()->getBody(); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -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,7 +56,7 @@ 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 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | http_response_code($this->error->getCode()); |
| 69 | 69 | echo $this->error->getResponse()->getBody(); |
| 70 | 70 | exit(); |
| 71 | - }else{ |
|
| 71 | + } else{ |
|
| 72 | 72 | return $this->error->getResponse()->getBody(); |
| 73 | 73 | } |
| 74 | 74 | } |