Completed
Push — master ( b9ac23...46f1c6 )
by ARCANEDEV
7s
created

Sku::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\SkuInterface;
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 SkuInterface
29
{
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Main Functions
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    /**
35
     * Retrieve a SKU.
36
     * @link   https://stripe.com/docs/api/php#retrieve_sku
37
     *
38
     * @param  string             $id
39
     * @param  array|string|null  $options
40
     *
41
     * @return self
42
     */
43 5
    public static function retrieve($id, $options = null)
44
    {
45 5
        return self::scopedRetrieve($id, $options);
46
    }
47
48
    /**
49
     * Create a SKU.
50
     * @link   https://stripe.com/docs/api/php#create_sku
51
     *
52
     * @param  array|null         $params
53
     * @param  array|string|null  $options
54
     *
55
     * @return self
56
     */
57 40
    public static function create($params = null, $options = null)
58
    {
59 40
        return self::scopedCreate($params, $options);
60
    }
61
62
    /**
63
     * Update a SKU.
64
     * @link   https://stripe.com/docs/api/php#update_sku
65
     *
66
     * @param  array|string|null  $options
67
     *
68
     * @return self
69
     */
70 5
    public function save($options = null)
71
    {
72 5
        return $this->scopedSave($options);
73
    }
74
75
    /**
76
     * List all SKUs.
77
     * @link   https://stripe.com/docs/api/php#list_skus
78
     *
79
     * @param  array|null         $params
80
     * @param  array|string|null  $options
81
     *
82
     * @return \Arcanedev\Stripe\Collection|array
83
     */
84
    public static function all($params = null, $options = null)
85
    {
86
        return self::scopedAll($params, $options);
87
    }
88
89
    /**
90
     * Delete a SKU.
91
     * @link   https://stripe.com/docs/api/php#delete_sku
92
     *
93
     * @param  array|null         $params
94
     * @param  array|string|null  $options
95
     *
96
     * @return self
97
     */
98 5
    public function delete($params = null, $options = null)
99
    {
100 5
        return $this->scopedDelete($params, $options);
101
    }
102
}
103