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

Items::reviews()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 4
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
8
class Items extends Client
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $namespace = __CLASS__;
14
15
    /**
16
     * Retrieve a item
17
     * Retrieves the details of a item. Provide the unique id for the item.
18
     *
19
     * @param int $item_id The item id
20
     *
21
     * @return $this
22
     */
23
    public function __invoke(int $item_id): self
24
    {
25
        $this->item_id = $item_id;
0 ignored issues
show
Bug Best Practice introduced by
The property item_id does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
26
27
        // Set HTTP params
28
        $this->type     = 'get';
29
        $this->endpoint = '/items/' . $item_id;
30
31
        return $this;
32
    }
33
34
    /**
35
     * List all items
36
     * Returns a list of your items. The items are returned sorted by creation date, with the most recent item appearing first.
37
     *
38
     * @return $this
39
     */
40
    public function all(): QueryInterface
41
    {
42
        // Set HTTP params
43
        $this->type     = 'get';
44
        $this->endpoint = '/items';
45
46
        return $this;
47
    }
48
49
    /**
50
     * List all item booking questions
51
     * Returns a list of your item booking questions.
52
     * The items are returned sorted by creation date, with the most recent item appearing first.
53
     *
54
     * @return \Resova\Interfaces\QueryInterface
55
     */
56
    public function booking_questions(): QueryInterface
57
    {
58
        // Set HTTP params
59
        $this->type     = 'get';
60
        $this->endpoint = '/items/' . $this->item_id . '/booking_questions';
61
62
        return $this;
63
    }
64
65
    /**
66
     * List all item reviews
67
     * Returns a list of your item reviews.
68
     * The items are returned sorted by creation date, with the most recent item appearing first.
69
     *
70
     * @return \Resova\Interfaces\QueryInterface
71
     */
72
    public function reviews(): QueryInterface
73
    {
74
        // Set HTTP params
75
        $this->type     = 'get';
76
        $this->endpoint = '/items/' . $this->item_id . '/reviews';
77
78
        return $this;
79
    }
80
81
    /**
82
     * List all item extras
83
     * Returns a list of your item extras.
84
     * The items are returned sorted by creation date, with the most recent item appearing first.
85
     *
86
     * @return \Resova\Interfaces\QueryInterface
87
     */
88
    public function extras(): QueryInterface
89
    {
90
        // Set HTTP params
91
        $this->type     = 'get';
92
        $this->endpoint = '/items/' . $this->item_id . '/extras';
93
94
        return $this;
95
    }
96
}
97