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

Dispute::close()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 7
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Stripe;
4
5
/**
6
 * Class Dispute
7
 *
8
 * @property string $id
9
 * @property string $object
10
 * @property int $amount
11
 * @property BalanceTransaction[] $balance_transactions
12
 * @property string $charge
13
 * @property int $created
14
 * @property string $currency
15
 * @property mixed $evidence
16
 * @property mixed $evidence_details
17
 * @property bool $is_charge_refundable
18
 * @property bool $livemode
19
 * @property StripeObject $metadata
20
 * @property string $reason
21
 * @property string $status
22
 *
23
 * @package Stripe
24
 */
25 View Code Duplication
class Dispute extends ApiResource
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
{
27
28
    const OBJECT_NAME = "dispute";
29
30
    use ApiOperations\All;
31
    use ApiOperations\Retrieve;
32
    use ApiOperations\Update;
33
34
    /**
35
     * Possible string representations of dispute reasons.
36
     * @link https://stripe.com/docs/api#dispute_object
37
     */
38
    const REASON_BANK_CANNOT_PROCESS       = 'bank_cannot_process';
39
    const REASON_CHECK_RETURNED            = 'check_returned';
40
    const REASON_CREDIT_NOT_PROCESSED      = 'credit_not_processed';
41
    const REASON_CUSTOMER_INITIATED        = 'customer_initiated';
42
    const REASON_DEBIT_NOT_AUTHORIZED      = 'debit_not_authorized';
43
    const REASON_DUPLICATE                 = 'duplicate';
44
    const REASON_FRAUDULENT                = 'fraudulent';
45
    const REASON_GENERAL                   = 'general';
46
    const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details';
47
    const REASON_INSUFFICIENT_FUNDS        = 'insufficient_funds';
48
    const REASON_PRODUCT_NOT_RECEIVED      = 'product_not_received';
49
    const REASON_PRODUCT_UNACCEPTABLE      = 'product_unacceptable';
50
    const REASON_SUBSCRIPTION_CANCELED     = 'subscription_canceled';
51
    const REASON_UNRECOGNIZED              = 'unrecognized';
52
53
    /**
54
     * Possible string representations of dispute statuses.
55
     * @link https://stripe.com/docs/api#dispute_object
56
     */
57
    const STATUS_CHARGE_REFUNDED        = 'charge_refunded';
58
    const STATUS_LOST                   = 'lost';
59
    const STATUS_NEEDS_RESPONSE         = 'needs_response';
60
    const STATUS_UNDER_REVIEW           = 'under_review';
61
    const STATUS_WARNING_CLOSED         = 'warning_closed';
62
    const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response';
63
    const STATUS_WARNING_UNDER_REVIEW   = 'warning_under_review';
64
    const STATUS_WON                    = 'won';
65
66
    /**
67
     * @param array|string|null $options
68
     *
69
     * @return Dispute The closed dispute.
70
     */
71
    public function close($options = null)
72
    {
73
        $url = $this->instanceUrl() . '/close';
74
        list($response, $opts) = $this->_request('post', $url, null, $options);
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
75
        $this->refreshFrom($response, $opts);
76
        return $this;
77
    }
78
}
79