Passed
Push — master ( fc2f89...038734 )
by compolom
02:33
created

GiftVouchers::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 5
cp 0
crap 2
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Resova\Endpoints;
4
5
use Resova\Client;
6
use Resova\Models\GiftVoucher;
7
use Resova\Models\GiftVoucherList;
8
9
class GiftVouchers extends Client
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $namespace = __CLASS__;
15
16
    /**
17
     * Retrieve a gift voucher
18
     * Retrieves the details of a gift voucher. Provide the unique id for the gift voucher.
19
     *
20
     * @param int $voucher_id The gift voucher id
21
     *
22
     * @return $this
23
     */
24 1
    public function __invoke(int $voucher_id): self
25
    {
26 1
        $this->voucher_id = $voucher_id;
0 ignored issues
show
Bug Best Practice introduced by
The property voucher_id does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
27
28
        // Set HTTP params
29 1
        $this->type     = 'get';
30 1
        $this->endpoint = '/gift_vouchers/' . $voucher_id;
31 1
        $this->response = GiftVoucher::class;
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
32
33 1
        return $this;
34
    }
35
36
    /**
37
     * List all gift vouchers
38
     * Returns a list of your gift vouchers.
39
     * The gift vouchers are returned sorted by creation date, with the most recent gift vouchers appearing first.
40
     *
41
     * @return $this
42
     */
43
    public function all(): self
44
    {
45
        // Set HTTP params
46
        $this->type     = 'get';
47
        $this->endpoint = '/gift_vouchers';
48
        $this->response = GiftVoucherList::class;
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
49
50
        return $this;
51
    }
52
}
53