@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function boot() |
20 | 20 | { |
21 | 21 | $this->publishes([ |
22 | - __DIR__.'/../config/asaas.php' => config_path('asaas.php'), |
|
22 | + __DIR__ . '/../config/asaas.php' => config_path('asaas.php'), |
|
23 | 23 | ]); |
24 | 24 | } |
25 | 25 | |
@@ -28,6 +28,6 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function register() |
30 | 30 | { |
31 | - $this->mergeConfigFrom(__DIR__.'/../config/asaas.php', 'asaas.php'); |
|
31 | + $this->mergeConfigFrom(__DIR__ . '/../config/asaas.php', 'asaas.php'); |
|
32 | 32 | } |
33 | 33 | } |
@@ -53,44 +53,44 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Retorna a listagem de clientes |
56 | - public function getAll($filtros = false){ |
|
56 | + public function getAll($filtros = false) { |
|
57 | 57 | return $this->http->get('/customers'); |
58 | 58 | } |
59 | 59 | |
60 | 60 | // Retorna os dados do cliente de acordo com o Id |
61 | - public function getById($id){ |
|
62 | - return $this->http->get('/customers/'.$id); |
|
61 | + public function getById($id) { |
|
62 | + return $this->http->get('/customers/' . $id); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Retorna os dados do cliente de acordo com o Email |
66 | - public function getByEmail($email){ |
|
66 | + public function getByEmail($email) { |
|
67 | 67 | $option = 'limit=1&email=' . $email; |
68 | 68 | return $this->http->get('/customers', $option); |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Insere um novo cliente |
72 | - public function create(array $dadosCliente){ |
|
72 | + public function create(array $dadosCliente) { |
|
73 | 73 | $dadosCliente = $this->setCliente($dadosCliente); |
74 | - if(!empty($dadosCliente['error'])){ |
|
74 | + if (!empty($dadosCliente['error'])) { |
|
75 | 75 | return $dadosCliente; |
76 | - }else { |
|
76 | + } else { |
|
77 | 77 | return $this->http->post('/customers', $dadosCliente); |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Atualiza os dados do cliente |
82 | - public function update($id, array $dadosCliente){ |
|
82 | + public function update($id, array $dadosCliente) { |
|
83 | 83 | $dadosCliente = $this->setCliente($dadosCliente); |
84 | - if(!empty($dadosCliente['error'])){ |
|
84 | + if (!empty($dadosCliente['error'])) { |
|
85 | 85 | return $dadosCliente; |
86 | - }else { |
|
86 | + } else { |
|
87 | 87 | return $this->http->post('/customers/' . $id, $dadosCliente); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | // Deleta uma cliente |
92 | - public function delete($id){ |
|
93 | - return $this->http->get('/customers/'.$id,'','DELETE'); |
|
92 | + public function delete($id) { |
|
93 | + return $this->http->get('/customers/' . $id, '', 'DELETE'); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public function setCliente($cliente) |
126 | 126 | { |
127 | 127 | try { |
128 | - if ( ! $this->cliente_valid($cliente) ) { |
|
128 | + if (!$this->cliente_valid($cliente)) { |
|
129 | 129 | return ClienteException::invalidClient(); |
130 | 130 | } |
131 | 131 | |
@@ -161,6 +161,6 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function cliente_valid($cliente) |
163 | 163 | { |
164 | - return ! ( (empty($cliente['name']) OR empty($cliente['cpfCnpj']) OR empty($cliente['email'])) ? 1 : '' ); |
|
164 | + return !((empty($cliente['name']) OR empty($cliente['cpfCnpj']) OR empty($cliente['email'])) ? 1 : ''); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | \ No newline at end of file |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $dadosCliente = $this->setCliente($dadosCliente); |
74 | 74 | if(!empty($dadosCliente['error'])){ |
75 | 75 | return $dadosCliente; |
76 | - }else { |
|
76 | + } else { |
|
77 | 77 | return $this->http->post('/customers', $dadosCliente); |
78 | 78 | } |
79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $dadosCliente = $this->setCliente($dadosCliente); |
84 | 84 | if(!empty($dadosCliente['error'])){ |
85 | 85 | return $dadosCliente; |
86 | - }else { |
|
86 | + } else { |
|
87 | 87 | return $this->http->post('/customers/' . $id, $dadosCliente); |
88 | 88 | } |
89 | 89 | } |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | - public function get($url, $option = false, $custom = false ) |
|
23 | + public function get($url, $option = false, $custom = false) |
|
24 | 24 | { |
25 | 25 | |
26 | 26 | $ch = curl_init(); |
27 | - curl_setopt($ch, CURLOPT_URL, $this->base_url .'.asaas.com/api/v3'. $url."?".$option); |
|
27 | + curl_setopt($ch, CURLOPT_URL, $this->base_url . '.asaas.com/api/v3' . $url . "?" . $option); |
|
28 | 28 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
29 | 29 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
30 | 30 | |
31 | - if(!empty($custom)){ |
|
31 | + if (!empty($custom)) { |
|
32 | 32 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $custom); |
33 | 33 | } |
34 | 34 | |
35 | 35 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
36 | 36 | "Content-Type: application/json", |
37 | - "access_token: ".(($this->api_status == 1) ? $this->api_key_live : $this->api_key) |
|
37 | + "access_token: " . (($this->api_status == 1) ? $this->api_key_live : $this->api_key) |
|
38 | 38 | )); |
39 | 39 | |
40 | 40 | $response = curl_exec($ch); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $params = json_encode($params); |
52 | 52 | $ch = curl_init(); |
53 | 53 | |
54 | - curl_setopt($ch, CURLOPT_URL, $this->base_url .'.asaas.com/api/v3'. $url); |
|
54 | + curl_setopt($ch, CURLOPT_URL, $this->base_url . '.asaas.com/api/v3' . $url); |
|
55 | 55 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
56 | 56 | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
63 | 63 | "Content-Type: application/json", |
64 | - "access_token: ".(($this->api_status == 1) ? $this->api_key_live : $this->api_key) |
|
64 | + "access_token: " . (($this->api_status == 1) ? $this->api_key_live : $this->api_key) |
|
65 | 65 | )); |
66 | 66 | |
67 | 67 | $response = curl_exec($ch); |