@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->logger = \Logger::getLogger(__CLASS__); |
36 | 36 | |
37 | - if(!is_null($params)) |
|
37 | + if (!is_null($params)) |
|
38 | 38 | { |
39 | 39 | foreach ($params as $key => $param) |
40 | 40 | { |
41 | - if(!in_array($key, array_keys($params))) |
|
41 | + if (!in_array($key, array_keys($params))) |
|
42 | 42 | throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
43 | 43 | } |
44 | 44 | } |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | putenv(sprintf("%s=%s", FipeApiParameter::FIPE_API_HOST, Client::DEFAULT_URL)); |
47 | 47 | putenv(sprintf("%s=%s", FipeApiParameter::FIPE_API_TIMEOUT, Client::DEFAULT_TIMEOUT)); |
48 | 48 | |
49 | - if(!is_null($params) && is_array($params)) |
|
49 | + if (!is_null($params) && is_array($params)) |
|
50 | 50 | { |
51 | 51 | foreach ($params as $key => $value) |
52 | - putenv(sprintf("%s=%s",$key,$value)); |
|
52 | + putenv(sprintf("%s=%s", $key, $value)); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function setParameter($key, $value) |
61 | 61 | { |
62 | - putenv(sprintf("%s=%s",$key,$value)); |
|
62 | + putenv(sprintf("%s=%s", $key, $value)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | { |
39 | 39 | foreach ($params as $key => $param) |
40 | 40 | { |
41 | - if(!in_array($key, array_keys($params))) |
|
42 | - throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
|
41 | + if(!in_array($key, array_keys($params))) { |
|
42 | + throw new \Exception(sprintf("Parâmetro %s inválido", $key)); |
|
43 | + } |
|
43 | 44 | } |
44 | 45 | } |
45 | 46 | |
@@ -48,8 +49,9 @@ discard block |
||
48 | 49 | |
49 | 50 | if(!is_null($params) && is_array($params)) |
50 | 51 | { |
51 | - foreach ($params as $key => $value) |
|
52 | - putenv(sprintf("%s=%s",$key,$value)); |
|
52 | + foreach ($params as $key => $value) { |
|
53 | + putenv(sprintf("%s=%s",$key,$value)); |
|
54 | + } |
|
53 | 55 | } |
54 | 56 | } |
55 | 57 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public static function getInstance($tipo) |
21 | 21 | { |
22 | 22 | |
23 | - switch($tipo) |
|
23 | + switch ($tipo) |
|
24 | 24 | { |
25 | 25 | case Tipo::MOTOS: return new ConsultaMotoApi(); |
26 | 26 | case Tipo::CAMINHOES: return new ConsultaMotoApi(); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $this->_curl = new Curl(); |
42 | 42 | $this->tipo = $tipo; |
43 | 43 | |
44 | - if(is_null($client)) |
|
44 | + if (is_null($client)) |
|
45 | 45 | { |
46 | 46 | $this->client = new Client(); |
47 | - }else{ |
|
47 | + }else { |
|
48 | 48 | $this->client = $client; |
49 | 49 | } |
50 | 50 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function getMarcas() |
58 | 58 | { |
59 | - try{ |
|
59 | + try { |
|
60 | 60 | $this->_curl->get(sprintf("%s/%s/marcas.json", |
61 | 61 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
62 | 62 | $this->tipo) |
63 | 63 | ); |
64 | 64 | return $this->getResponse(); |
65 | - }catch(\Exception $ex){ |
|
65 | + }catch (\Exception $ex) { |
|
66 | 66 | $this->logger->error("Falha ao executar requisição", $ex); |
67 | 67 | throw new \Exception($ex->getMessage()); |
68 | 68 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getVeiculos($fabricante) |
78 | 78 | { |
79 | - try{ |
|
79 | + try { |
|
80 | 80 | $this->_curl->get(sprintf("%s/%s/veiculos/%s.json", |
81 | 81 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
82 | 82 | $this->tipo, |
83 | 83 | $fabricante) |
84 | 84 | ); |
85 | 85 | return $this->getResponse(); |
86 | - }catch(\Exception $ex){ |
|
86 | + }catch (\Exception $ex) { |
|
87 | 87 | $this->logger->error("Falha ao executar requisição", $ex); |
88 | 88 | throw new \Exception($ex->getMessage()); |
89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function getModelos($fabricante, $veiculo) |
100 | 100 | { |
101 | - try{ |
|
101 | + try { |
|
102 | 102 | $this->_curl->get(sprintf("%s/%s/veiculo/%s/%s.json", |
103 | 103 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
104 | 104 | $this->tipo, |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $veiculo) |
107 | 107 | ); |
108 | 108 | return $this->getResponse(); |
109 | - }catch(\Exception $ex){ |
|
109 | + }catch (\Exception $ex) { |
|
110 | 110 | $this->logger->error("Falha ao executar requisição", $ex); |
111 | 111 | throw new \Exception($ex->getMessage()); |
112 | 112 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | public function getDetalhes($fabricante, $veiculo, $fipeCodigo) |
116 | 116 | { |
117 | - try{ |
|
117 | + try { |
|
118 | 118 | $this->_curl->get(sprintf("%s/%s/veiculo/%s/%s/%s.json", |
119 | 119 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
120 | 120 | $this->tipo, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $fipeCodigo) |
124 | 124 | ); |
125 | 125 | return $this->getResponse(); |
126 | - }catch(\Exception $ex){ |
|
126 | + }catch (\Exception $ex) { |
|
127 | 127 | $this->logger->error("Falha ao executar requisição", $ex); |
128 | 128 | throw new \Exception($ex->getMessage()); |
129 | 129 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if(is_null($client)) |
45 | 45 | { |
46 | 46 | $this->client = new Client(); |
47 | - }else{ |
|
47 | + } else{ |
|
48 | 48 | $this->client = $client; |
49 | 49 | } |
50 | 50 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->tipo) |
63 | 63 | ); |
64 | 64 | return $this->getResponse(); |
65 | - }catch(\Exception $ex){ |
|
65 | + } catch(\Exception $ex){ |
|
66 | 66 | $this->logger->error("Falha ao executar requisição", $ex); |
67 | 67 | throw new \Exception($ex->getMessage()); |
68 | 68 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $fabricante) |
84 | 84 | ); |
85 | 85 | return $this->getResponse(); |
86 | - }catch(\Exception $ex){ |
|
86 | + } catch(\Exception $ex){ |
|
87 | 87 | $this->logger->error("Falha ao executar requisição", $ex); |
88 | 88 | throw new \Exception($ex->getMessage()); |
89 | 89 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $veiculo) |
107 | 107 | ); |
108 | 108 | return $this->getResponse(); |
109 | - }catch(\Exception $ex){ |
|
109 | + } catch(\Exception $ex){ |
|
110 | 110 | $this->logger->error("Falha ao executar requisição", $ex); |
111 | 111 | throw new \Exception($ex->getMessage()); |
112 | 112 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $fipeCodigo) |
124 | 124 | ); |
125 | 125 | return $this->getResponse(); |
126 | - }catch(\Exception $ex){ |
|
126 | + } catch(\Exception $ex){ |
|
127 | 127 | $this->logger->error("Falha ao executar requisição", $ex); |
128 | 128 | throw new \Exception($ex->getMessage()); |
129 | 129 | } |