Completed
Push — master ( 4673d4...250c7f )
by Mr
01:55
created

GiftVouchers::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 10
ccs 0
cts 6
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\Interfaces\QueryInterface;
7
use Resova\Models\GiftVoucher;
8
use Resova\Models\GiftVoucherList;
9
10
class GiftVouchers extends Client
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $namespace = __CLASS__;
16
17
    /**
18
     * Retrieve a gift voucher
19
     * Retrieves the details of a gift voucher. Provide the unique id for the gift voucher.
20
     *
21
     * @param int $voucher_id The gift voucher id
22
     *
23
     * @return $this
24
     */
25
    public function __invoke(int $voucher_id): self
26
    {
27
        $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...
28
29
        // Set HTTP params
30
        $this->type     = 'get';
31
        $this->endpoint = '/gift_vouchers/' . $voucher_id;
32
        $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...
33
34
        return $this;
35
    }
36
37
    /**
38
     * List all gift vouchers
39
     * Returns a list of your gift vouchers.
40
     * The gift vouchers are returned sorted by creation date, with the most recent gift vouchers appearing first.
41
     *
42
     * @return \Resova\Interfaces\QueryInterface
43
     */
44
    public function all(): QueryInterface
45
    {
46
        // Set HTTP params
47
        $this->type     = 'get';
48
        $this->endpoint = '/gift_vouchers';
49
        $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...
50
51
        return $this;
52
    }
53
}
54