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

Items   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Test Coverage

Coverage 80.95%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 18
c 1
b 0
f 1
dl 0
loc 87
ccs 17
cts 21
cp 0.8095
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 7 1
A reviews() 0 7 1
A __invoke() 0 9 1
A extras() 0 7 1
A booking_questions() 0 7 1
1
<?php
2
3
namespace Resova\Endpoints;
4
5
use Resova\Client;
6
7
class Items extends Client
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $namespace = __CLASS__;
13
14
    /**
15
     * Retrieve a item
16
     * Retrieves the details of a item. Provide the unique id for the item.
17
     *
18
     * @param int $item_id The item id
19
     *
20
     * @return $this
21
     */
22 1
    public function __invoke(int $item_id): self
23
    {
24 1
        $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...
25
26
        // Set HTTP params
27 1
        $this->type     = 'get';
28 1
        $this->endpoint = '/items/' . $item_id;
29
30 1
        return $this;
31
    }
32
33
    /**
34
     * List all items
35
     * Returns a list of your items. The items are returned sorted by creation date, with the most recent item appearing first.
36
     *
37
     * @return $this
38
     */
39
    public function all(): self
40
    {
41
        // Set HTTP params
42
        $this->type     = 'get';
43
        $this->endpoint = '/items';
44
45
        return $this;
46
    }
47
48
    /**
49
     * List all item booking questions
50
     * Returns a list of your item booking questions.
51
     * The items are returned sorted by creation date, with the most recent item appearing first.
52
     *
53
     * @return $this
54
     */
55 1
    public function booking_questions(): self
56
    {
57
        // Set HTTP params
58 1
        $this->type     = 'get';
59 1
        $this->endpoint = '/items/' . $this->item_id . '/booking_questions';
60
61 1
        return $this;
62
    }
63
64
    /**
65
     * List all item reviews
66
     * Returns a list of your item reviews.
67
     * The items are returned sorted by creation date, with the most recent item appearing first.
68
     *
69
     * @return $this
70
     */
71 1
    public function reviews(): self
72
    {
73
        // Set HTTP params
74 1
        $this->type     = 'get';
75 1
        $this->endpoint = '/items/' . $this->item_id . '/reviews';
76
77 1
        return $this;
78
    }
79
80
    /**
81
     * List all item extras
82
     * Returns a list of your item extras.
83
     * The items are returned sorted by creation date, with the most recent item appearing first.
84
     *
85
     * @return $this
86
     */
87 1
    public function extras(): self
88
    {
89
        // Set HTTP params
90 1
        $this->type     = 'get';
91 1
        $this->endpoint = '/items/' . $this->item_id . '/extras';
92
93 1
        return $this;
94
    }
95
}
96