Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Cep |
||
14 | { |
||
15 | use Curl; |
||
16 | |||
17 | const URL_VIACEP = 'http://viacep.com.br/ws'; |
||
18 | |||
19 | /** @var string */ |
||
20 | private $cep; |
||
21 | |||
22 | /** @var string */ |
||
23 | private $error; |
||
24 | |||
25 | /** |
||
26 | * Cep constructor. |
||
27 | * @param string $cep |
||
28 | */ |
||
29 | public function __construct(string $cep) |
||
30 | { |
||
31 | $this->cep = preg_replace("/[^0-9]/", "", $cep); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return string |
||
36 | */ |
||
37 | public function getError(): string |
||
38 | { |
||
39 | return $this->error; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return array |
||
44 | */ |
||
45 | public function getAddr(): ?array |
||
56 | } |
||
57 | } |
||
58 | } |