Total Complexity | 6 |
Total Lines | 86 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class Invoices extends CafeApi |
||
10 | { |
||
11 | /** |
||
12 | * Invoices constructor |
||
13 | * @param string $apiUrl |
||
14 | * @param string $email |
||
15 | * @param string $password |
||
16 | */ |
||
17 | public function __construct(string $apiUrl, string $email, string $password) |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @param array|null $headers |
||
24 | * @return Invoices |
||
25 | */ |
||
26 | public function index(?array $headers): Invoices |
||
27 | { |
||
28 | $this->request( |
||
29 | "GET", |
||
30 | "/invoices", |
||
31 | null, |
||
32 | $headers |
||
33 | ); |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param array $fields |
||
40 | * @return Invoices |
||
41 | */ |
||
42 | public function create(array $fields): Invoices |
||
43 | { |
||
44 | $this->request( |
||
45 | "POST", |
||
46 | "/invoices", |
||
47 | $fields |
||
48 | ); |
||
49 | |||
50 | return $this; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param int $invoiceId |
||
55 | * @return Invoices |
||
56 | */ |
||
57 | public function read(int $invoiceId): Invoices |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @param int $invoiceId |
||
69 | * @param array $fields |
||
70 | * @return Invoices |
||
71 | */ |
||
72 | public function update(int $invoiceId, array $fields): Invoices |
||
73 | { |
||
74 | $this->request( |
||
75 | "PUT", |
||
76 | "/invoices/{$invoiceId}", |
||
77 | $fields |
||
78 | ); |
||
79 | |||
80 | return $this; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param int $invoiceId |
||
85 | * @return Invoices |
||
86 | */ |
||
87 | public function delete(int $invoiceId): Invoices |
||
95 | } |
||
96 | } |