Subscriptions   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 10
c 1
b 0
f 0
dl 0
loc 57
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 5 1
A read() 0 5 1
A index() 0 5 1
A create() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
/** Namespace */
4
namespace MatheusBastos\CafeApi;
5
6
/**
7
 * Subscriptions Api class
8
 * @package MatheusBastos\CafeApi
9
 */
10
class Subscriptions extends CafeApi
11
{
12
    /**
13
     * Subscriptions constructor
14
     * @param string $api_url
15
     * @param string $email
16
     * @param string $password
17
     */
18
    public function __construct(string $api_url, string $email, string $password)
19
    {
20
        parent::__construct($api_url, $email, $password);
21
    }
22
23
    /**
24
     * Index
25
     * @return Subscriptions
26
     */
27
    public function index(): Subscriptions
28
    {
29
        $this->request('GET', '/subscription');
30
31
        return $this;
32
    }
33
34
    /**
35
     * Create
36
     * @param array $fields
37
     * @return Subscriptions
38
     */
39
    public function create(array $fields): Subscriptions
40
    {
41
        $this->request('POST', '/subscription', $fields);
42
43
        return $this;
44
    }
45
46
    /**
47
     * Read
48
     * @return Subscriptions
49
     */
50
    public function read(): Subscriptions
51
    {
52
        $this->request('GET', '/subscription/plans');
53
54
        return $this;
55
    }
56
57
    /**
58
     * Update
59
     * @param array $fields
60
     * @return Subscriptions
61
     */
62
    public function update(array $fields): Subscriptions
63
    {
64
        $this->request('PUT', '/subscription', $fields);
65
66
        return $this;
67
    }
68
}
69