@@ -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,16 +38,16 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function __construct($tipo, Client $client = null) |
| 40 | 40 | { |
| 41 | - if(is_null($this->logger)) |
|
| 41 | + if (is_null($this->logger)) |
|
| 42 | 42 | $this->logger = \Logger::getLogger(__CLASS__); |
| 43 | 43 | |
| 44 | 44 | $this->_curl = new Curl(); |
| 45 | 45 | $this->tipo = $tipo; |
| 46 | 46 | |
| 47 | - if(is_null($client)) |
|
| 47 | + if (is_null($client)) |
|
| 48 | 48 | { |
| 49 | 49 | $this->client = new Client(); |
| 50 | - }else{ |
|
| 50 | + }else { |
|
| 51 | 51 | $this->client = $client; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function getMarcas() |
| 61 | 61 | { |
| 62 | - try{ |
|
| 62 | + try { |
|
| 63 | 63 | $this->_curl->get(sprintf("%s/%s/marcas.json", |
| 64 | 64 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
| 65 | 65 | $this->tipo) |
| 66 | 66 | ); |
| 67 | 67 | return $this->getResponse(); |
| 68 | - }catch(\Exception $ex){ |
|
| 68 | + }catch (\Exception $ex) { |
|
| 69 | 69 | $this->logger->error("Falha ao executar requisição", $ex); |
| 70 | 70 | throw new \Exception($ex->getMessage()); |
| 71 | 71 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function getVeiculos($fabricante) |
| 81 | 81 | { |
| 82 | - try{ |
|
| 82 | + try { |
|
| 83 | 83 | $this->_curl->get(sprintf("%s/%s/veiculos/%s.json", |
| 84 | 84 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
| 85 | 85 | $this->tipo, |
| 86 | 86 | $fabricante) |
| 87 | 87 | ); |
| 88 | 88 | return $this->getResponse(); |
| 89 | - }catch(\Exception $ex){ |
|
| 89 | + }catch (\Exception $ex) { |
|
| 90 | 90 | $this->logger->error("Falha ao executar requisição", $ex); |
| 91 | 91 | throw new \Exception($ex->getMessage()); |
| 92 | 92 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function getModelos($fabricante, $veiculo) |
| 103 | 103 | { |
| 104 | - try{ |
|
| 104 | + try { |
|
| 105 | 105 | $this->_curl->get(sprintf("%s/%s/veiculo/%s/%s.json", |
| 106 | 106 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
| 107 | 107 | $this->tipo, |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $veiculo) |
| 110 | 110 | ); |
| 111 | 111 | return $this->getResponse(); |
| 112 | - }catch(\Exception $ex){ |
|
| 112 | + }catch (\Exception $ex) { |
|
| 113 | 113 | $this->logger->error("Falha ao executar requisição", $ex); |
| 114 | 114 | throw new \Exception($ex->getMessage()); |
| 115 | 115 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | public function getDetalhes($fabricante, $veiculo, $fipeCodigo) |
| 119 | 119 | { |
| 120 | - try{ |
|
| 120 | + try { |
|
| 121 | 121 | $this->_curl->get(sprintf("%s/%s/veiculo/%s/%s/%s.json", |
| 122 | 122 | $this->client->getParameter(FipeApiParameter::FIPE_API_HOST), |
| 123 | 123 | $this->tipo, |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $fipeCodigo) |
| 127 | 127 | ); |
| 128 | 128 | return $this->getResponse(); |
| 129 | - }catch(\Exception $ex){ |
|
| 129 | + }catch (\Exception $ex) { |
|
| 130 | 130 | $this->logger->error("Falha ao executar requisição", $ex); |
| 131 | 131 | throw new \Exception($ex->getMessage()); |
| 132 | 132 | } |