| Total Complexity | 6 |
| Total Lines | 86 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class InvoiceController extends CafeApiController |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Invoices 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 | * @param array|null $headers |
||
| 22 | * @return InvoiceController |
||
| 23 | */ |
||
| 24 | public function index(?array $headers): InvoiceController |
||
| 25 | { |
||
| 26 | $this->request( |
||
| 27 | "GET", |
||
| 28 | "/invoices", |
||
| 29 | null, |
||
| 30 | $headers |
||
| 31 | ); |
||
| 32 | |||
| 33 | return $this; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param array $fields |
||
| 38 | * @return InvoiceController |
||
| 39 | */ |
||
| 40 | public function create(array $fields): InvoiceController |
||
| 41 | { |
||
| 42 | $this->request( |
||
| 43 | "POST", |
||
| 44 | "/invoices", |
||
| 45 | $fields |
||
| 46 | ); |
||
| 47 | |||
| 48 | return $this; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param int $invoiceId |
||
| 53 | * @return InvoiceController |
||
| 54 | */ |
||
| 55 | public function read(int $invoiceId): InvoiceController |
||
| 56 | { |
||
| 57 | $this->request( |
||
| 58 | "GET", |
||
| 59 | "/invoices/{$invoiceId}" |
||
| 60 | ); |
||
| 61 | |||
| 62 | return $this; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param int $invoiceId |
||
| 67 | * @param array $fields |
||
| 68 | * @return InvoiceController |
||
| 69 | */ |
||
| 70 | public function update(int $invoiceId, array $fields): InvoiceController |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @param int $invoiceId |
||
| 83 | * @return InvoiceController |
||
| 84 | */ |
||
| 85 | public function delete(int $invoiceId): InvoiceController |
||
| 93 | } |
||
| 94 | } |
||
| 95 |