@@ -47,8 +47,9 @@ |
||
47 | 47 | { |
48 | 48 | throw new \Exception("Basic authenticanão não é suportado pela api por enquanto"); |
49 | 49 | |
50 | - if(!empty($this->key)) |
|
51 | - return sprintf("Basic %s", $this->key); |
|
50 | + if(!empty($this->key)) { |
|
51 | + return sprintf("Basic %s", $this->key); |
|
52 | + } |
|
52 | 53 | |
53 | 54 | return sprintf("Basic %s", base64_encode(sprintf("%s:%s", $this->user, $this->password))); |
54 | 55 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | public function getAuthorization() |
54 | 54 | { |
55 | - if(!empty($this->key)) |
|
55 | + if (!empty($this->key)) |
|
56 | 56 | return $this->key; |
57 | 57 | |
58 | 58 | $response = $this->_loginApi->login( |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | public function getAuthorization() |
54 | 54 | { |
55 | - if(!empty($this->key)) |
|
55 | + if (!empty($this->key)) |
|
56 | 56 | return $this->key; |
57 | 57 | |
58 | 58 | $response = $this->_loginApi->login( |
@@ -52,8 +52,9 @@ |
||
52 | 52 | */ |
53 | 53 | public function getAuthorization() |
54 | 54 | { |
55 | - if(!empty($this->key)) |
|
56 | - return $this->key; |
|
55 | + if(!empty($this->key)) { |
|
56 | + return $this->key; |
|
57 | + } |
|
57 | 58 | |
58 | 59 | $response = $this->_loginApi->login( |
59 | 60 | (new LoginRequest()) |
@@ -62,7 +62,7 @@ |
||
62 | 62 | { |
63 | 63 | |
64 | 64 | foreach ($intencoesVendas as $intencaoVenda) |
65 | - $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
65 | + $this->intencoesVendas[ ] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
66 | 66 | |
67 | 67 | return $this; |
68 | 68 | } |
@@ -61,8 +61,9 @@ |
||
61 | 61 | public function setIntencoesVendas($intencoesVendas) |
62 | 62 | { |
63 | 63 | |
64 | - foreach ($intencoesVendas as $intencaoVenda) |
|
65 | - $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
64 | + foreach ($intencoesVendas as $intencaoVenda) { |
|
65 | + $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
66 | + } |
|
66 | 67 | |
67 | 68 | return $this; |
68 | 69 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s.u', $data); |
46 | 46 | |
47 | - if(!$this->data) |
|
47 | + if (!$this->data) |
|
48 | 48 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
49 | 49 | |
50 | 50 | return $this; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $this->terminal = $terminal; |
68 | 68 | |
69 | - if(is_array($this->terminal)) |
|
69 | + if (is_array($this->terminal)) |
|
70 | 70 | $this->terminal = SerializerHelper::denormalize($this->terminal, Terminal::class); |
71 | 71 | |
72 | 72 | return $this; |
@@ -44,8 +44,9 @@ discard block |
||
44 | 44 | { |
45 | 45 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s.u', $data); |
46 | 46 | |
47 | - if(!$this->data) |
|
48 | - $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
|
47 | + if(!$this->data) { |
|
48 | + $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
|
49 | + } |
|
49 | 50 | |
50 | 51 | return $this; |
51 | 52 | } |
@@ -66,8 +67,9 @@ discard block |
||
66 | 67 | { |
67 | 68 | $this->terminal = $terminal; |
68 | 69 | |
69 | - if(is_array($this->terminal)) |
|
70 | - $this->terminal = SerializerHelper::denormalize($this->terminal, Terminal::class); |
|
70 | + if(is_array($this->terminal)) { |
|
71 | + $this->terminal = SerializerHelper::denormalize($this->terminal, Terminal::class); |
|
72 | + } |
|
71 | 73 | |
72 | 74 | return $this; |
73 | 75 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | { |
63 | 63 | |
64 | 64 | foreach ($intencoesVendas as $intencaoVenda) |
65 | - $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
65 | + $this->intencoesVendas[ ] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
66 | 66 | |
67 | 67 | return $this; |
68 | 68 | } |
@@ -61,8 +61,9 @@ |
||
61 | 61 | public function setIntencoesVendas($intencoesVendas) |
62 | 62 | { |
63 | 63 | |
64 | - foreach ($intencoesVendas as $intencaoVenda) |
|
65 | - $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
64 | + foreach ($intencoesVendas as $intencaoVenda) { |
|
65 | + $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
66 | + } |
|
66 | 67 | |
67 | 68 | return $this; |
68 | 69 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | { |
63 | 63 | |
64 | 64 | foreach ($intencoesVendas as $intencaoVenda) |
65 | - $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
65 | + $this->intencoesVendas[ ] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
66 | 66 | |
67 | 67 | return $this; |
68 | 68 | } |
@@ -61,8 +61,9 @@ |
||
61 | 61 | public function setIntencoesVendas($intencoesVendas) |
62 | 62 | { |
63 | 63 | |
64 | - foreach ($intencoesVendas as $intencaoVenda) |
|
65 | - $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
64 | + foreach ($intencoesVendas as $intencaoVenda) { |
|
65 | + $this->intencoesVendas[] = SerializerHelper::denormalize($intencaoVenda, IntencaoVenda::class); |
|
66 | + } |
|
66 | 67 | |
67 | 68 | return $this; |
68 | 69 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function getByPessoaId($pessoaId) |
32 | 32 | { |
33 | - try{ |
|
34 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
33 | + try { |
|
34 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
35 | 35 | 'query' => $this->addQueryAdditionalParameters([ |
36 | 36 | 'pessoaId' => $pessoaId |
37 | 37 | ]) |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | ); |
44 | 44 | }catch (RequestException $ex) { |
45 | 45 | $responseBody = $ex->getResponse()->json(); |
46 | - throw new \Exception($responseBody['message']); |
|
47 | - }catch (\Exception $ex){ |
|
46 | + throw new \Exception($responseBody[ 'message' ]); |
|
47 | + }catch (\Exception $ex) { |
|
48 | 48 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
49 | 49 | } |
50 | 50 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function getById($terminalId) |
58 | 58 | { |
59 | - try{ |
|
60 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
59 | + try { |
|
60 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
61 | 61 | 'query' => $this->addQueryAdditionalParameters([ |
62 | 62 | 'terminalId' => $terminalId |
63 | 63 | ]) |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | ); |
70 | 70 | }catch (RequestException $ex) { |
71 | 71 | $responseBody = $ex->getResponse()->json(); |
72 | - throw new \Exception($responseBody['message']); |
|
73 | - }catch (\Exception $ex){ |
|
72 | + throw new \Exception($responseBody[ 'message' ]); |
|
73 | + }catch (\Exception $ex) { |
|
74 | 74 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
75 | 75 | } |
76 | 76 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function insert(Contracts\Terminal\InsertRequest $insertRequest) |
84 | 84 | { |
85 | - try{ |
|
86 | - $response = $this->_httpClient->post(__FUNCTION__,[ |
|
85 | + try { |
|
86 | + $response = $this->_httpClient->post(__FUNCTION__, [ |
|
87 | 87 | 'body' => json_encode($insertRequest) |
88 | 88 | ]); |
89 | 89 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | ); |
94 | 94 | }catch (RequestException $ex) { |
95 | 95 | $responseBody = $ex->getResponse()->json(); |
96 | - throw new \Exception($responseBody['message']); |
|
97 | - }catch (\Exception $ex){ |
|
96 | + throw new \Exception($responseBody[ 'message' ]); |
|
97 | + }catch (\Exception $ex) { |
|
98 | 98 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
99 | 99 | } |
100 | 100 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | $response->json(), |
41 | 41 | Contracts\Login\LoginResponse::class |
42 | 42 | ); |
43 | - }catch (RequestException $ex) { |
|
43 | + } catch (RequestException $ex) { |
|
44 | 44 | $responseBody = $ex->getResponse()->json(); |
45 | 45 | throw new \Exception($responseBody['message']); |
46 | - }catch (\Exception $ex){ |
|
46 | + } catch (\Exception $ex){ |
|
47 | 47 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
48 | 48 | } |
49 | 49 | } |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | $this->_httpClient->post(__FUNCTION__,[]); |
59 | 59 | |
60 | 60 | return true; |
61 | - }catch (RequestException $ex) { |
|
61 | + } catch (RequestException $ex) { |
|
62 | 62 | $responseBody = $ex->getResponse()->json(); |
63 | 63 | throw new \Exception($responseBody['message']); |
64 | - }catch (\Exception $ex){ |
|
64 | + } catch (\Exception $ex){ |
|
65 | 65 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
66 | 66 | } |
67 | 67 | } |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | $response->json(), |
83 | 83 | Contracts\Login\ConsultaLoginResponse::class |
84 | 84 | ); |
85 | - }catch (RequestException $ex) { |
|
85 | + } catch (RequestException $ex) { |
|
86 | 86 | $responseBody = $ex->getResponse()->json(); |
87 | 87 | throw new \Exception($responseBody['message']); |
88 | - }catch (\Exception $ex){ |
|
88 | + } catch (\Exception $ex){ |
|
89 | 89 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
90 | 90 | } |
91 | 91 | } |