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

AlipayAccount   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 6
1
<?php
2
3
namespace Stripe;
4
5
/**
6
 * Class AlipayAccount
7
 *
8
 * @package Stripe
9
 *
10
 * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
11
 * @link https://stripe.com/docs/sources/alipay
12
 */
13
class AlipayAccount extends ApiResource
14
{
15
16
    const OBJECT_NAME = "alipay_account";
17
18
    use ApiOperations\Delete;
19
    use ApiOperations\Update;
20
21
    /**
22
     * @return string The instance URL for this resource. It needs to be special
23
     *    cased because it doesn't fit into the standard resource pattern.
24
     */
25
    public function instanceUrl()
26
    {
27
        if ($this['customer']) {
28
            $base = Customer::classUrl();
29
            $parent = $this['customer'];
30
            $path = 'sources';
31
        } else {
32
            $msg = "Alipay accounts cannot be accessed without a customer ID.";
33
            throw new Error\InvalidRequest($msg, null);
34
        }
35
        $parentExtn = urlencode(Util\Util::utf8($parent));
36
        $extn = urlencode(Util\Util::utf8($this['id']));
37
        return "$base/$parentExtn/$path/$extn";
38
    }
39
40
    /**
41
     * @param array|string $_id
42
     * @param array|string|null $_opts
43
     *
44
     * @throws \Stripe\Error\InvalidRequest
45
     *
46
     * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
47
     * @link https://stripe.com/docs/sources/alipay
48
     */
49
    public static function retrieve($_id, $_opts = null)
0 ignored issues
show
Unused Code introduced by
The parameter $_id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $_opts is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        $msg = "Alipay accounts cannot be accessed without a customer ID. " .
52
               "Retrieve an Alipay account using \$customer->sources->retrieve('alipay_account_id') instead.";
53
        throw new Error\InvalidRequest($msg, null);
54
    }
55
56
    /**
57
     * @param string $_id
58
     * @param array|null $_params
59
     * @param array|string|null $_options
60
     *
61
     * @throws \Stripe\Error\InvalidRequest
62
     *
63
     * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
64
     * @link https://stripe.com/docs/sources/alipay
65
     */
66
    public static function update($_id, $_params = null, $_options = null)
0 ignored issues
show
Unused Code introduced by
The parameter $_id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $_params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $_options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
    {
68
        $msg = "Alipay accounts cannot be accessed without a customer ID. " .
69
               "Call save() on \$customer->sources->retrieve('alipay_account_id') instead.";
70
        throw new Error\InvalidRequest($msg, null);
71
    }
72
}
73