1 | <?php |
||||
2 | |||||
3 | namespace CodePhix\Asaas; |
||||
4 | |||||
5 | |||||
6 | class Notificacao { |
||||
7 | // |
||||
8 | |||||
9 | public $http; |
||||
10 | |||||
11 | public function __construct(Connection $connection) |
||||
12 | { |
||||
13 | $this->http = $connection; |
||||
14 | } |
||||
15 | |||||
16 | // Retorna a listagem de notificações |
||||
17 | public function getAll(array $filtros){ |
||||
18 | $filtro = ''; |
||||
19 | if(is_array($filtros)){ |
||||
20 | if($filtros){ |
||||
0 ignored issues
–
show
|
|||||
21 | foreach($filtros as $key => $f){ |
||||
22 | if(!empty($f)){ |
||||
23 | if($filtro){ |
||||
24 | $filtro .= '&'; |
||||
25 | } |
||||
26 | $filtro .= $key.'='.$f; |
||||
27 | } |
||||
28 | } |
||||
29 | $filtro = '?'.$filtro; |
||||
30 | } |
||||
31 | } |
||||
32 | return $this->http->get('/notifications'.$filtro); |
||||
33 | } |
||||
34 | |||||
35 | // Retorna os dados da notificação de acordo com o Id |
||||
36 | public function getById($id){ |
||||
37 | return $this->http->get('/notifications/'.$id); |
||||
38 | } |
||||
39 | |||||
40 | // Retorna a listagem de notificações de acordo com o Id do Cliente |
||||
41 | public function getByCustomer($customer_id){ |
||||
42 | return $this->http->get('/customers/'.$customer_id.'/notifications'); |
||||
43 | } |
||||
44 | |||||
45 | // Insere uma nova notificação |
||||
46 | public function create(array $dadosNotificacao){ |
||||
47 | return $this->http->post('/notifications', $dadosNotificacao); |
||||
48 | } |
||||
49 | |||||
50 | // Atualiza os dados da notificação |
||||
51 | public function update($id, array $dadosNotificacao){ |
||||
0 ignored issues
–
show
The parameter
$id is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
52 | return $this->http->post('/notifications', $dadosNotificacao); |
||||
53 | } |
||||
54 | |||||
55 | // Deleta uma notificação |
||||
56 | public function delete($id){ |
||||
57 | return $this->http->get('/notifications/'.$id,'','DELETE'); |
||||
58 | } |
||||
59 | |||||
60 | } |
||||
61 |
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
empty(..)
or! empty(...)
instead.