Sku   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 90
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1
wmc 6
lcom 0
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 4 1
A retrieve() 0 4 1
A create() 0 4 1
A update() 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\Sku as SkuContract;
4
use Arcanedev\Stripe\StripeResource;
5
6
/**
7
 * Class     Sku
8
 *
9
 * @package  Arcanedev\Stripe\Resources
10
 * @author   ARCANEDEV <[email protected]>
11
 * @link     https://stripe.com/docs/api/php#sku_object
12
 *
13
 * @property  string                            id
14
 * @property  string                            object             // 'sku'
15
 * @property  bool                              active
16
 * @property  array                             attributes
17
 * @property  int                               created             // timestamp
18
 * @property  string                            currency
19
 * @property  string                            image
20
 * @property  \Arcanedev\Stripe\StripeObject    inventory
21
 * @property  bool                              livemode
22
 * @property  \Arcanedev\Stripe\AttachedObject  metadata
23
 * @property  array                             package_dimensions
24
 * @property  int                               price
25
 * @property  string                            product
26
 * @property  int                               updated             // timestamp
27
 */
28
class Sku extends StripeResource implements SkuContract
29
{
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Main Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * List all SKUs.
36
     * @link   https://stripe.com/docs/api/php#list_skus
37
     *
38
     * @param  array|null         $params
39
     * @param  array|string|null  $options
40
     *
41
     * @return \Arcanedev\Stripe\Collection|array
42
     */
43 2
    public static function all($params = [], $options = null)
44
    {
45 2
        return self::scopedAll($params, $options);
46
    }
47
48
    /**
49
     * Retrieve a SKU.
50
     * @link   https://stripe.com/docs/api/php#retrieve_sku
51
     *
52
     * @param  string             $id
53
     * @param  array|string|null  $options
54
     *
55
     * @return self
56
     */
57 4
    public static function retrieve($id, $options = null)
58
    {
59 4
        return self::scopedRetrieve($id, $options);
60
    }
61
62
    /**
63
     * Create a SKU.
64
     * @link   https://stripe.com/docs/api/php#create_sku
65
     *
66
     * @param  array|null         $params
67
     * @param  array|string|null  $options
68
     *
69
     * @return self
70
     */
71 26
    public static function create($params = [], $options = null)
72
    {
73 26
        return self::scopedCreate($params, $options);
74
    }
75
76
    /**
77
     * Update a SKU.
78
     * @link   https://stripe.com/docs/api/php#update_sku
79
     *
80
     * @param  string             $id
81
     * @param  array|null         $params
82
     * @param  array|string|null  $options
83
     *
84
     * @return self
85
     */
86 2
    public static function update($id, $params = [], $options = null)
87
    {
88 2
        return self::scopedUpdate($id, $params, $options);
89
    }
90
91
    /**
92
     * Update/Save a SKU.
93
     * @link   https://stripe.com/docs/api/php#update_sku
94
     *
95
     * @param  array|string|null  $options
96
     *
97
     * @return self
98
     */
99 4
    public function save($options = null)
100
    {
101 4
        return $this->scopedSave($options);
102
    }
103
104
    /**
105
     * Delete a SKU.
106
     * @link   https://stripe.com/docs/api/php#delete_sku
107
     *
108
     * @param  array|null         $params
109
     * @param  array|string|null  $options
110
     *
111
     * @return self
112
     */
113 4
    public function delete($params = [], $options = null)
114
    {
115 4
        return $this->scopedDelete($params, $options);
116
    }
117
}
118