Test Failed
Push — master ( 3dd85e...34f16b )
by Devin
04:34 queued 10s
created

Authorization   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A approve() 0 7 1
A decline() 0 7 1
1
<?php
2
3
namespace Stripe\Issuing;
4
5
/**
6
 * Class Authorization
7
 *
8
 * @property string $id
9
 * @property string $object
10
 * @property bool $approved
11
 * @property string $authorization_method
12
 * @property int $authorized_amount
13
 * @property string $authorized_currency
14
 * @property \Stripe\Collection $balance_transactions
15
 * @property Card $card
16
 * @property Cardholder $cardholder
17
 * @property int $created
18
 * @property int $held_amount
19
 * @property string $held_currency
20
 * @property bool $is_held_amount_controllable
21
 * @property bool $livemode
22
 * @property mixed $merchant_data
23
 * @property \Stripe\StripeObject $metadata
24
 * @property int $pending_authorized_amount
25
 * @property int $pending_held_amount
26
 * @property mixed $request_history
27
 * @property string $status
28
 * @property \Stripe\Collection $transactions
29
 * @property mixed $verification_data
30
 *
31
 * @package Stripe\Issuing
32
 */
33
class Authorization extends \Stripe\ApiResource
34
{
35
    const OBJECT_NAME = "issuing.authorization";
36
37
    use \Stripe\ApiOperations\All;
38
    use \Stripe\ApiOperations\Retrieve;
39
    use \Stripe\ApiOperations\Update;
40
41
    /**
42
     * @param array|null $params
43
     * @param array|string|null $options
44
     *
45
     * @return Authorization The approved authorization.
46
     */
47
    public function approve($params = null, $options = null)
48
    {
49
        $url = $this->instanceUrl() . '/approve';
50
        list($response, $opts) = $this->_request('post', $url, $params, $options);
0 ignored issues
show
Bug introduced by
It seems like $params can also be of type null; however, Stripe\ApiOperations\Request::_request() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
51
        $this->refreshFrom($response, $opts);
52
        return $this;
53
    }
54
55
    /**
56
     * @param array|null $params
57
     * @param array|string|null $options
58
     *
59
     * @return Authorization The declined authorization.
60
     */
61
    public function decline($params = null, $options = null)
62
    {
63
        $url = $this->instanceUrl() . '/decline';
64
        list($response, $opts) = $this->_request('post', $url, $params, $options);
0 ignored issues
show
Bug introduced by
It seems like $params can also be of type null; however, Stripe\ApiOperations\Request::_request() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
65
        $this->refreshFrom($response, $opts);
66
        return $this;
67
    }
68
}
69