Wallets   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 86
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
A update() 0 9 1
A read() 0 8 1
A index() 0 10 1
A __construct() 0 3 1
A delete() 0 8 1
1
<?php
2
3
namespace CarlosBrito\CafeApi;
4
5
/**
6
 * Class Wallets
7
 * @package RobsonVLeite\CafeApi
8
 */
9
class Wallets extends CafeApi
10
{
11
    /**
12
     * Wallets constructor.
13
     * @param string $apiUrl
14
     * @param string $email
15
     * @param string $password
16
     */
17
    public function __construct(string $apiUrl, string $email, string $password)
18
    {
19
        parent::__construct($apiUrl, $email, $password);
20
    }
21
22
    /**
23
     * @param array|null $headers
24
     * @return Wallets
25
     */
26
    public function index(?array $headers): Wallets
27
    {
28
        $this->request(
29
            "GET",
30
            "/wallets",
31
            null,
32
            $headers
33
        );
34
35
        return $this;
36
    }
37
38
    /**
39
     * @param array $fields
40
     * @return Wallets
41
     */
42
    public function create(array $fields): Wallets
43
    {
44
        $this->request(
45
            "POST",
46
            "/wallets",
47
            $fields
48
        );
49
50
        return $this;
51
    }
52
53
    /**
54
     * @param int $walletId
55
     * @return Wallets
56
     */
57
    public function read(int $walletId): Wallets
58
    {
59
        $this->request(
60
            "GET",
61
            "/wallets/{$walletId}"
62
        );
63
64
        return $this;
65
    }
66
67
    /**
68
     * @param int $walletId
69
     * @param array $fields
70
     * @return Wallets
71
     */
72
    public function update(int $walletId, array $fields): Wallets
73
    {
74
        $this->request(
75
            "PUT",
76
            "/wallets/{$walletId}",
77
            $fields
78
        );
79
80
        return $this;
81
    }
82
83
    /**
84
     * @param int $walletId
85
     * @return Wallets
86
     */
87
    public function delete(int $walletId): Wallets
88
    {
89
        $this->request(
90
            "DELETE",
91
            "/wallets/{$walletId}"
92
        );
93
94
        return $this;
95
    }
96
}