1 | <?php |
||
2 | |||
3 | namespace CodePhix\Asaas; |
||
4 | |||
5 | |||
6 | class Cidades { |
||
7 | |||
8 | public $http; |
||
9 | |||
10 | public function __construct(Connection $connection) |
||
11 | { |
||
12 | $this->http = $connection; |
||
13 | } |
||
14 | |||
15 | // Retorna a listagem de cobranças |
||
16 | public function getAll(array $filtros){ |
||
17 | $filtro = ''; |
||
18 | if(is_array($filtros)){ |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
19 | if($filtros){ |
||
0 ignored issues
–
show
The expression
$filtros of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent. Consider making the comparison explicit by using ![]() |
|||
20 | foreach($filtros as $key => $f){ |
||
21 | if(!empty($f)){ |
||
22 | if($filtro){ |
||
23 | $filtro .= '&'; |
||
24 | } |
||
25 | $filtro .= $key.'='.$f; |
||
26 | } |
||
27 | } |
||
28 | $filtro = '?'.$filtro; |
||
29 | } |
||
30 | } |
||
31 | return $this->http->get('/cities'.$filtro); |
||
32 | } |
||
33 | |||
34 | // Retorna os dados da cobrança de acordo com o Id |
||
35 | public function getById($id){ |
||
36 | return $this->http->get('/cities/'.$id); |
||
37 | } |
||
38 | |||
39 | } |
||
40 |