Transferencia::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace CodePhix\Asaas;
4
5
6
class Transferencia {
7
8
    public $http;
9
10
    public function __construct(Connection $connection)
11
    {
12
        $this->http = $connection;
13
    }
14
15
16
    public function getAll($parametos = false){
17
        $filtro = '';
18
        if(is_array($parametos)){
19
            if($parametos){
0 ignored issues
show
Bug Best Practice introduced by
The expression $parametos 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 empty(..) or ! empty(...) instead.

Loading history...
20
                foreach($parametos 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('/transfers/'.$filtro);
32
        //https://www.asaas.com/api/v3/subscriptions/id/invoices?offset=&limit=&status=
33
    }
34
35
    public function consultaSaldo(){
36
        return $this->http->get('/finance/getCurrentBalance');
37
    }
38
39
    public function consultaWalletId(){
40
        return $this->http->get('/wallets');
41
    }
42
43
44
    public function conta($dadosConta){
45
        return $this->http->post('/transfers', $dadosConta);
46
    }
47
}
48