@@ -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,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()) |
@@ -92,8 +92,9 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $this->impressora = $impressora; |
| 94 | 94 | |
| 95 | - if(is_array($this->impressora)) |
|
| 96 | - $this->impressora = SerializerHelper::denormalize($this->impressora, Impressora::class); |
|
| 95 | + if(is_array($this->impressora)) { |
|
| 96 | + $this->impressora = SerializerHelper::denormalize($this->impressora, Impressora::class); |
|
| 97 | + } |
|
| 97 | 98 | |
| 98 | 99 | return $this; |
| 99 | 100 | } |
@@ -114,8 +115,9 @@ discard block |
||
| 114 | 115 | { |
| 115 | 116 | $this->pessoa = $pessoa; |
| 116 | 117 | |
| 117 | - if(is_array($this->pessoa)) |
|
| 118 | - $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
|
| 118 | + if(is_array($this->pessoa)) { |
|
| 119 | + $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
|
| 120 | + } |
|
| 119 | 121 | |
| 120 | 122 | return $this; |
| 121 | 123 | } |
@@ -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,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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -41,10 +41,10 @@ |
||
| 41 | 41 | $response->json(), |
| 42 | 42 | Contracts\Produto\GetByAtivosByPessoaIdResponse::class |
| 43 | 43 | ); |
| 44 | - }catch (RequestException $ex) { |
|
| 44 | + } catch (RequestException $ex) { |
|
| 45 | 45 | $responseBody = $ex->getResponse()->json(); |
| 46 | 46 | throw new \Exception($responseBody['message']); |
| 47 | - }catch (\Exception $ex){ |
|
| 47 | + } catch (\Exception $ex){ |
|
| 48 | 48 | throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); |
| 49 | 49 | } |
| 50 | 50 | } |