@@ -78,7 +78,7 @@ |
||
78 | 78 | */ |
79 | 79 | public function getCookies() |
80 | 80 | { |
81 | - return $this->cookies; |
|
81 | + return $this->cookies; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | const URL_REFER = 'https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_solicitacao3.asp'; |
13 | 13 | const URL_POST = 'https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/valida.asp'; |
14 | 14 | |
15 | - private $attributes =[ |
|
15 | + private $attributes = [ |
|
16 | 16 | 'NOME EMPRESARIAL' => 'razao_social', |
17 | 17 | 'TÍTULO DO ESTABELECIMENTO (NOME DE FANTASIA)' => 'nome_fantasia', |
18 | 18 | 'CÓDIGO E DESCRIÇÃO DA ATIVIDADE ECONÔMICA PRINCIPAL' => 'cnae_principal', |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | |
107 | 107 | if ($response->getStatusCode() == 200) { |
108 | 108 | $contents = $response->getBody()->getContents(); |
109 | - if (preg_match_all('/<table border="0" width="100%" style="\s+BORDER-COLLAPSE: collapse;\s+">.*?<\/table>/ism', $contents , $matches)) { |
|
110 | - foreach($matches[0] as $html) { |
|
109 | + if (preg_match_all('/<table border="0" width="100%" style="\s+BORDER-COLLAPSE: collapse;\s+">.*?<\/table>/ism', $contents, $matches)) { |
|
110 | + foreach ($matches[0] as $html) { |
|
111 | 111 | $result = array_merge($result, $this->parseCNPJ($html)); |
112 | 112 | } |
113 | 113 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | if ($info->count() > 0) { |
135 | 135 | $key = trim(strip_tags(preg_replace('/\s+/', ' ', $info->html()))); |
136 | - $attr = isset($this->attributes[$key]) ? $this->attributes[$key] : null; |
|
136 | + $attr = isset($this->attributes[$key]) ? $this->attributes[$key] : null; |
|
137 | 137 | |
138 | 138 | if ($attr === null) { |
139 | 139 | continue; |
@@ -146,10 +146,11 @@ |
||
146 | 146 | $str = trim(preg_replace('/\s+/', ' ', $b->html())); |
147 | 147 | $attach = htmlspecialchars_decode($str); |
148 | 148 | |
149 | - if ($bs->count() == 1) |
|
150 | - $result[$attr] = $attach; |
|
151 | - else |
|
152 | - $result[$attr][] = $attach; |
|
149 | + if ($bs->count() == 1) { |
|
150 | + $result[$attr] = $attach; |
|
151 | + } else { |
|
152 | + $result[$attr][] = $attach; |
|
153 | + } |
|
153 | 154 | } |
154 | 155 | } |
155 | 156 | } |