Completed
Push — master ( a39575...82bd32 )
by ARCANEDEV
21:20 queued 06:33
created

EphemeralKey::delete()   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 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\EphemeralKey as EphemeralKeyContract;
4
use Arcanedev\Stripe\StripeResource;
5
use InvalidArgumentException;
6
7
/**
8
 * Class     EphemeralKey
9
 *
10
 * @package  Arcanedev\Stripe\Resources
11
 * @author   ARCANEDEV <[email protected]>
12
 *
13
 * @property  string  $id
14
 * @property  string  $object
15
 * @property  int     $created
16
 * @property  int     $expires
17
 * @property  bool    $livemode
18
 * @property  string  $secret
19
 * @property  array   $associated_objects
20
 */
21
class EphemeralKey extends StripeResource implements EphemeralKeyContract
22
{
23
    /* -----------------------------------------------------------------
24
     |  Getters & Setters
25
     | -----------------------------------------------------------------
26
     */
27
28
    /**
29
     * Get The name of the class, with namespacing and underscores stripped.
30
     *
31
     * @param  string  $class
32
     *
33
     * @return string
34
     */
35
    public static function className($class = '')
36
    {
37
        return 'ephemeral_key';
38
    }
39
40
    /* -----------------------------------------------------------------
41
     |  Main Methods
42
     | -----------------------------------------------------------------
43
     */
44
45
    /**
46
     * Create the Ephemeral Key.
47
     *
48
     * @param array|null $params
49
     * @param array|string|null $options
50
     *
51
     * @return self
52
     */
53 15
    public static function create($params = [], $options = null)
54
    {
55 15
        if ( ! $options['stripe_version']) {
56 6
            throw new InvalidArgumentException(
57 4
                'The `stripe_version` must be specified to create an ephemeral key'
58 2
            );
59
        }
60
61 9
        return self::scopedCreate($params, $options);
62
    }
63
64
    /**
65
     * Delete the Ephemeral Key.
66
     *
67
     * @param  array|null         $params
68
     * @param  array|string|null  $options
69
     *
70
     * @return self
71
     */
72 3
    public function delete($params = [], $options = null)
73
    {
74 3
        return $this->scopedDelete($params, $options);
75
    }
76
}
77