Total Complexity | 5 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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 |
||
74 | } |
||
75 | } |
||
76 |