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

SubscriptionScheduleRevision   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
dl 0
loc 57
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A instanceUrl() 0 19 2
A retrieve() 0 6 1
A all() 0 6 1
1
<?php
2
3
namespace Stripe;
4
5
/**
6
 * Class SubscriptionScheduleRevision
7
 *
8
 * @property string $id
9
 * @property string $object
10
 * @property int $created
11
 * @property mixed $invoice_settings
12
 * @property boolean $livemode
13
 * @property mixed $phases
14
 * @property string $previous_revision
15
 * @property string $renewal_behavior
16
 * @property mixed $renewal_interval
17
 * @property string $schedule
18
 *
19
 * @package Stripe
20
 */
21
class SubscriptionScheduleRevision extends ApiResource
22
{
23
24
    const OBJECT_NAME = "subscription_schedule_revision";
25
26
    use ApiOperations\All;
27
    use ApiOperations\Retrieve;
28
29
    /**
30
     * @return string The API URL for this Subscription Schedule Revision.
31
     */
32
    public function instanceUrl()
33
    {
34
        $id = $this['id'];
35
        $schedule = $this['schedule'];
36
        if (!$id) {
37
            throw new Error\InvalidRequest(
38
                "Could not determine which URL to request: " .
39
                "class instance has invalid ID: $id",
40
                null
41
            );
42
        }
43
        $id = Util\Util::utf8($id);
44
        $schedule = Util\Util::utf8($schedule);
45
46
        $base = SubscriptionSchedule::classUrl();
47
        $scheduleExtn = urlencode($schedule);
48
        $extn = urlencode($id);
49
        return "$base/$scheduleExtn/revisions/$extn";
50
    }
51
52
    /**
53
     * @param array|string $_id
54
     * @param array|string|null $_opts
55
     *
56
     * @throws \Stripe\Error\InvalidRequest
57
     */
58
    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...
59
    {
60
        $msg = "Subscription Schedule Revisions cannot be accessed without a Subscription Schedule ID. " .
61
               "Retrieve one using \$schedule->retrieveRevision('revision_id') instead.";
62
        throw new Error\InvalidRequest($msg, null);
63
    }
64
65
    /**
66
     * @param array|string $_id
0 ignored issues
show
Bug introduced by
There is no parameter named $_id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
67
     * @param array|string|null $_opts
0 ignored issues
show
Bug introduced by
There is no parameter named $_opts. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
68
     *
69
     * @throws \Stripe\Error\InvalidRequest
70
     */
71
    public static function all($params = null, $opts = null)
0 ignored issues
show
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 $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...
72
    {
73
        $msg = "Subscription Schedule Revisions cannot be listed without a Subscription Schedule ID. " .
74
               "List those using \$schedule->allRevisions('revision_id') instead.";
75
        throw new Error\InvalidRequest($msg, null);
76
    }
77
}
78