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

EphemeralKey   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
dl 0
loc 56
c 0
b 0
f 0
ccs 8
cts 10
cp 0.8
rs 10
wmc 4
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A className() 0 4 1
A create() 0 10 2
A delete() 0 4 1
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