Completed
Push — master ( 8bbda0...ede634 )
by ARCANEDEV
8s
created

Plan   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 20%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 80
ccs 2
cts 10
cp 0.2
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 4 1
A all() 0 4 1
A create() 0 4 1
A save() 0 4 1
A delete() 0 4 1
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\PlanInterface;
4
use Arcanedev\Stripe\StripeResource;
5
6
/**
7
 * Class     Plan
8
 *
9
 * @package  Arcanedev\Stripe\Resources
10
 * @author   ARCANEDEV <[email protected]>
11
 * @link     https://stripe.com/docs/api/php#plan_object
12
 *
13
 * @property  string                            id
14
 * @property  string                            object                // "plan"
15
 * @property  bool                              livemode
16
 * @property  int                               amount
17
 * @property  int                               created
18
 * @property  int                               currency
19
 * @property  string                            interval
20
 * @property  int                               interval_count
21
 * @property  string                            name
22
 * @property  \Arcanedev\Stripe\AttachedObject  metadata
23
 * @property  int                               trial_period_days
24
 * @property  string                            statement_descriptor
25
 *
26
 * @todo:     Update the properties.
27
 */
28
class Plan extends StripeResource implements PlanInterface
29
{
30
    /* ------------------------------------------------------------------------------------------------
31
     |  CRUD Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Retrieve a Plan.
36
     *
37
     * @link   https://stripe.com/docs/api/php#retrieve_plan
38
     *
39
     * @param  string             $id
40
     * @param  array|string|null  $options
41
     *
42
     * @return self
43
     */
44 50
    public static function retrieve($id, $options = null)
45
    {
46 50
        return self::scopedRetrieve($id, $options);
47
    }
48
49
    /**
50
     * List all Plans.
51
     *
52
     * @link   https://stripe.com/docs/api/php#list_plans
53
     *
54
     * @param  array|null         $params
55
     * @param  array|string|null  $options
56
     *
57
     * @return \Arcanedev\Stripe\Collection|array
58
     */
59
    public static function all($params = [], $options = null)
60
    {
61
        return self::scopedAll($params, $options);
62
    }
63
64
    /**
65
     * Create a plan.
66
     *
67
     * @link   https://stripe.com/docs/api/php#create_plan
68
     *
69
     * @param  array|null         $params
70
     * @param  array|string|null  $options
71
     *
72
     * @return self|array
73
     */
74
    public static function create($params = [], $options = null)
75
    {
76
        return self::scopedCreate($params, $options);
77
    }
78
79
    /**
80
     * Update/Save a plan.
81
     *
82
     * @link   https://stripe.com/docs/api/php#update_plan
83
     *
84
     * @param  array|string|null  $options
85
     *
86
     * @return self
87
     */
88
    public function save($options = null)
89
    {
90
        return self::scopedSave($options);
91
    }
92
93
    /**
94
     * Delete a plan.
95
     *
96
     * @link   https://stripe.com/docs/api/php#delete_plan
97
     *
98
     * @param  array|null         $params
99
     * @param  array|string|null  $options
100
     *
101
     * @return self
102
     */
103
    public function delete($params = [], $options = null)
104
    {
105
        return self::scopedDelete($params, $options);
106
    }
107
}
108