SubscriptionController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 3
dl 0
loc 3
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
3
namespace ItsMeLePassos\CafeApi;
4
5
use ItsMeLePassos\CafeApi\API\CafeApiController;
6
7
class SubscriptionController extends CafeApiController
8
{
9
    /**
10
     * SubscriptionController constructor.
11
     * @param string $apiUrl
12
     * @param string $email
13
     * @param string $password
14
     */
15
    public function __construct(string $apiUrl, string $email, string $password)
16
    {
17
        parent::__construct($apiUrl, $email, $password);
18
    }
19
20
    /**
21
     * @return SubscriptionController
22
     */
23
    public function index(): SubscriptionController
24
    {
25
        $this->request(
26
            "GET",
27
            "/subscription"
28
        );
29
30
        return $this;
31
    }
32
33
    /**
34
     * @param array $fields
35
     * @return SubscriptionController
36
     */
37
    public function create(array $fields): SubscriptionController
38
    {
39
        $this->request(
40
            "POST",
41
            "/subscription",
42
            $fields
43
        );
44
45
        return $this;
46
    }
47
48
    /**
49
     * @return SubscriptionController
50
     */
51
    public function read(): SubscriptionController
52
    {
53
        $this->request(
54
            "GET",
55
            "/subscription/plans"
56
        );
57
58
        return $this;
59
    }
60
61
    /**
62
     * @param array $fields
63
     * @return SubscriptionController
64
     */
65
    public function update(array $fields): SubscriptionController
66
    {
67
        $this->request(
68
            "PUT",
69
            "/subscription",
70
            $fields
71
        );
72
73
        return $this;
74
    }
75
}
76