Wallets::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/** Namespace */
4
namespace MatheusBastos\CafeApi;
5
6
/**
7
 * Wallets Api class
8
 * @package MatheusBastos\CafeApi
9
 */
10
class Wallets extends CafeApi
11
{
12
    /**
13
     * Wallets 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
     * @param array|null $headers
26
     * @return Wallets
27
     */
28
    public function index(?array $headers): Wallets
29
    {
30
        $this->request('GET', '/wallets', null, $headers);
31
32
        return $this;
33
    }
34
35
    /**
36
     * Create
37
     * @param array $fields
38
     * @return Wallets
39
     */
40
    public function create(array $fields): Wallets
41
    {
42
        $this->request('POST', '/wallets', $fields);
43
44
        return $this;
45
    }
46
47
    /**
48
     * Read
49
     * @param int $wallet_id
50
     * @return Wallets
51
     */
52
    public function read(int $wallet_id): Wallets
53
    {
54
        $this->request('GET', "/wallets/{$wallet_id}");
55
56
        return $this;
57
    }
58
59
    /**
60
     * Update
61
     * @param int $wallet_id
62
     * @param array $fields
63
     * @return Wallets
64
     */
65
    public function update(int $wallet_id, array $fields): Wallets
66
    {
67
        $this->request('PUT', "/wallets/{$wallet_id}", $fields);
68
69
        return $this;
70
    }
71
72
    /**
73
     * Delete
74
     * @param int $wallet_id
75
     * @return Wallets
76
     */
77
    public function delete(int $wallet_id): Wallets
78
    {
79
        $this->request('DELETE', "/wallets/{$wallet_id}");
80
81
        return $this;
82
    }
83
}
84