@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getParameter($key) |
72 | 72 | { |
73 | - return isset($this->_params[$key]) ? $this->_params[$key] : null; |
|
73 | + return isset($this->_params[ $key ]) ? $this->_params[ $key ] : null; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function setParameter($key, $value) |
84 | 84 | { |
85 | - $this->_params[$key] = $value; |
|
85 | + $this->_params[ $key ] = $value; |
|
86 | 86 | $this->loadParameters($this->_params, $this->authentication); |
87 | 87 | return $this; |
88 | 88 | } |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | */ |
97 | 97 | private function loadParameters($params, IAuthentication $authentication = null) |
98 | 98 | { |
99 | - $this->_params[ControlPayParameter::CONTROLPAY_HOST] = getenv('CONTROLPAY_HOST'); |
|
100 | - $this->_params[ControlPayParameter::CONTROLPAY_TIMEOUT] = getenv('CONTROLPAY_TIMEOUT'); |
|
101 | - $this->_params[ControlPayParameter::CONTROLPAY_USER] = getenv('CONTROLPAY_USER'); |
|
102 | - $this->_params[ControlPayParameter::CONTROLPAY_PWD] = getenv('CONTROLPAY_PWD'); |
|
103 | - $this->_params[ControlPayParameter::CONTROLPAY_KEY] = getenv('CONTROLPAY_KEY'); |
|
104 | - $this->_params[ControlPayParameter::CONTROLPAY_OAUTH_TYPE] = KeyQueryStringAuthentication::class; |
|
105 | - |
|
106 | - if(!is_null($params)) |
|
99 | + $this->_params[ ControlPayParameter::CONTROLPAY_HOST ] = getenv('CONTROLPAY_HOST'); |
|
100 | + $this->_params[ ControlPayParameter::CONTROLPAY_TIMEOUT ] = getenv('CONTROLPAY_TIMEOUT'); |
|
101 | + $this->_params[ ControlPayParameter::CONTROLPAY_USER ] = getenv('CONTROLPAY_USER'); |
|
102 | + $this->_params[ ControlPayParameter::CONTROLPAY_PWD ] = getenv('CONTROLPAY_PWD'); |
|
103 | + $this->_params[ ControlPayParameter::CONTROLPAY_KEY ] = getenv('CONTROLPAY_KEY'); |
|
104 | + $this->_params[ ControlPayParameter::CONTROLPAY_OAUTH_TYPE ] = KeyQueryStringAuthentication::class; |
|
105 | + |
|
106 | + if (!is_null($params)) |
|
107 | 107 | foreach ($params as $key => $param) |
108 | 108 | { |
109 | - if(!in_array($key, [ |
|
109 | + if (!in_array($key, [ |
|
110 | 110 | ControlPayParameter::CONTROLPAY_HOST, |
111 | 111 | ControlPayParameter::CONTROLPAY_TIMEOUT, |
112 | 112 | ControlPayParameter::CONTROLPAY_USER, |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
118 | 118 | } |
119 | 119 | |
120 | - if(!is_null($params) && is_array($params)) |
|
120 | + if (!is_null($params) && is_array($params)) |
|
121 | 121 | foreach ($params as $key => $value) |
122 | - $this->_params[$key] = $value; |
|
122 | + $this->_params[ $key ] = $value; |
|
123 | 123 | |
124 | - if(is_null($authentication)) |
|
124 | + if (is_null($authentication)) |
|
125 | 125 | { |
126 | 126 | $this->authentication = AuthenticationFactory::getInstance($this->_params, $this); |
127 | 127 | return; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $this->_params[ControlPayParameter::CONTROLPAY_KEY] = getenv('CONTROLPAY_KEY'); |
104 | 104 | $this->_params[ControlPayParameter::CONTROLPAY_OAUTH_TYPE] = KeyQueryStringAuthentication::class; |
105 | 105 | |
106 | - if(!is_null($params)) |
|
107 | - foreach ($params as $key => $param) |
|
106 | + if(!is_null($params)) { |
|
107 | + foreach ($params as $key => $param) |
|
108 | 108 | { |
109 | 109 | if(!in_array($key, [ |
110 | 110 | ControlPayParameter::CONTROLPAY_HOST, |
@@ -115,11 +115,13 @@ discard block |
||
115 | 115 | ControlPayParameter::CONTROLPAY_OAUTH_TYPE |
116 | 116 | ])) |
117 | 117 | throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
118 | + } |
|
118 | 119 | } |
119 | 120 | |
120 | - if(!is_null($params) && is_array($params)) |
|
121 | - foreach ($params as $key => $value) |
|
121 | + if(!is_null($params) && is_array($params)) { |
|
122 | + foreach ($params as $key => $value) |
|
122 | 123 | $this->_params[$key] = $value; |
124 | + } |
|
123 | 125 | |
124 | 126 | if(is_null($authentication)) |
125 | 127 | { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $this->pessoa = $pessoa; |
86 | 86 | |
87 | - if(is_array($pessoa)) |
|
87 | + if (is_array($pessoa)) |
|
88 | 88 | $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
89 | 89 | |
90 | 90 | return $this; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $this->operador = $operador; |
108 | 108 | |
109 | - if(is_array($this->operador)) |
|
109 | + if (is_array($this->operador)) |
|
110 | 110 | $this->operador = SerializerHelper::denormalize($this->operador, Operador::class); |
111 | 111 | |
112 | 112 | return $this; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | $this->android = $android; |
130 | 130 | |
131 | - if(is_array($this->android)) |
|
131 | + if (is_array($this->android)) |
|
132 | 132 | $this->android = SerializerHelper::denormalize($this->android, Device::class); |
133 | 133 | |
134 | 134 | return $this; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $this->ios = $ios; |
152 | 152 | |
153 | - if(is_array($this->ios)) |
|
153 | + if (is_array($this->ios)) |
|
154 | 154 | $this->ios = SerializerHelper::denormalize($this->ios, Device::class); |
155 | 155 | |
156 | 156 | return $this; |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | { |
85 | 85 | $this->pessoa = $pessoa; |
86 | 86 | |
87 | - if(is_array($pessoa)) |
|
88 | - $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
|
87 | + if(is_array($pessoa)) { |
|
88 | + $this->pessoa = SerializerHelper::denormalize($this->pessoa, Pessoa::class); |
|
89 | + } |
|
89 | 90 | |
90 | 91 | return $this; |
91 | 92 | } |
@@ -106,8 +107,9 @@ discard block |
||
106 | 107 | { |
107 | 108 | $this->operador = $operador; |
108 | 109 | |
109 | - if(is_array($this->operador)) |
|
110 | - $this->operador = SerializerHelper::denormalize($this->operador, Operador::class); |
|
110 | + if(is_array($this->operador)) { |
|
111 | + $this->operador = SerializerHelper::denormalize($this->operador, Operador::class); |
|
112 | + } |
|
111 | 113 | |
112 | 114 | return $this; |
113 | 115 | } |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | { |
129 | 131 | $this->android = $android; |
130 | 132 | |
131 | - if(is_array($this->android)) |
|
132 | - $this->android = SerializerHelper::denormalize($this->android, Device::class); |
|
133 | + if(is_array($this->android)) { |
|
134 | + $this->android = SerializerHelper::denormalize($this->android, Device::class); |
|
135 | + } |
|
133 | 136 | |
134 | 137 | return $this; |
135 | 138 | } |
@@ -150,8 +153,9 @@ discard block |
||
150 | 153 | { |
151 | 154 | $this->ios = $ios; |
152 | 155 | |
153 | - if(is_array($this->ios)) |
|
154 | - $this->ios = SerializerHelper::denormalize($this->ios, Device::class); |
|
156 | + if(is_array($this->ios)) { |
|
157 | + $this->ios = SerializerHelper::denormalize($this->ios, Device::class); |
|
158 | + } |
|
155 | 159 | |
156 | 160 | return $this; |
157 | 161 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | { |
63 | 63 | $this->intencaoVenda = $intencaoVenda; |
64 | 64 | |
65 | - if(is_array($this->intencaoVenda)) |
|
65 | + if (is_array($this->intencaoVenda)) |
|
66 | 66 | $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class); |
67 | 67 | |
68 | 68 | return $this; |
@@ -62,8 +62,9 @@ |
||
62 | 62 | { |
63 | 63 | $this->intencaoVenda = $intencaoVenda; |
64 | 64 | |
65 | - if(is_array($this->intencaoVenda)) |
|
66 | - $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class); |
|
65 | + if(is_array($this->intencaoVenda)) { |
|
66 | + $this->intencaoVenda = SerializerHelper::denormalize($this->intencaoVenda, IntencaoVenda::class); |
|
67 | + } |
|
67 | 68 | |
68 | 69 | return $this; |
69 | 70 | } |
@@ -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 | |
68 | 68 | foreach ($pagamentosExterno as $item) |
69 | - $this->pagamentosExterno[] = SerializerHelper::denormalize($item, PagamentoExterno::class); |
|
69 | + $this->pagamentosExterno[ ] = SerializerHelper::denormalize($item, PagamentoExterno::class); |
|
70 | 70 | |
71 | 71 | return $this; |
72 | 72 | } |
@@ -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 | } |
@@ -65,8 +66,9 @@ discard block |
||
65 | 66 | public function setPagamentosExterno($pagamentosExterno) |
66 | 67 | { |
67 | 68 | |
68 | - foreach ($pagamentosExterno as $item) |
|
69 | - $this->pagamentosExterno[] = SerializerHelper::denormalize($item, PagamentoExterno::class); |
|
69 | + foreach ($pagamentosExterno as $item) { |
|
70 | + $this->pagamentosExterno[] = SerializerHelper::denormalize($item, PagamentoExterno::class); |
|
71 | + } |
|
70 | 72 | |
71 | 73 | return $this; |
72 | 74 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s.u', $data); |
47 | 47 | |
48 | - if(!$this->data) |
|
48 | + if (!$this->data) |
|
49 | 49 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
50 | 50 | |
51 | 51 | return $this; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public function setTerminais($terminais) |
67 | 67 | { |
68 | 68 | foreach ($terminais as $item) |
69 | - $this->terminais[] = SerializerHelper::denormalize($item, Terminal::class); |
|
69 | + $this->terminais[ ] = SerializerHelper::denormalize($item, Terminal::class); |
|
70 | 70 | |
71 | 71 | return $this; |
72 | 72 | } |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->data = \DateTime::createFromFormat('d/m/Y H:i:s.u', $data); |
47 | 47 | |
48 | - if(!$this->data) |
|
49 | - $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
|
48 | + if(!$this->data) { |
|
49 | + $this->data = \DateTime::createFromFormat('d/m/Y H:i:s', $data); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | return $this; |
52 | 53 | } |
@@ -65,8 +66,9 @@ discard block |
||
65 | 66 | */ |
66 | 67 | public function setTerminais($terminais) |
67 | 68 | { |
68 | - foreach ($terminais as $item) |
|
69 | - $this->terminais[] = SerializerHelper::denormalize($item, Terminal::class); |
|
69 | + foreach ($terminais as $item) { |
|
70 | + $this->terminais[] = SerializerHelper::denormalize($item, Terminal::class); |
|
71 | + } |
|
70 | 72 | |
71 | 73 | return $this; |
72 | 74 | } |
@@ -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 | } |
@@ -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 | |
68 | 68 | foreach ($produtos as $item) |
69 | - $this->produtos[] = SerializerHelper::denormalize($item, Produto::class); |
|
69 | + $this->produtos[ ] = SerializerHelper::denormalize($item, Produto::class); |
|
70 | 70 | |
71 | 71 | return $this; |
72 | 72 | } |
@@ -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 | } |
@@ -65,8 +66,9 @@ discard block |
||
65 | 66 | public function setProdutos($produtos) |
66 | 67 | { |
67 | 68 | |
68 | - foreach ($produtos as $item) |
|
69 | - $this->produtos[] = SerializerHelper::denormalize($item, Produto::class); |
|
69 | + foreach ($produtos as $item) { |
|
70 | + $this->produtos[] = SerializerHelper::denormalize($item, Produto::class); |
|
71 | + } |
|
70 | 72 | |
71 | 73 | return $this; |
72 | 74 | } |
@@ -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 | } |
@@ -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( |