Passed
Push — master ( 396363...2462db )
by Alex
05:04 queued 01:36
created

DeviceRequest::addresses()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Axsor\PhpIPAM\Http\Requests;
4
5
class DeviceRequest extends Connector
6
{
7
    public function index()
8
    {
9
        return $this->get('devices');
10
    }
11
12
    public function show($device)
13
    {
14
        $id = get_id_from_variable($device);
15
16
        return $this->get("devices/{$id}");
17
    }
18
19
    public function subnets($device)
20
    {
21
        $id = get_id_from_variable($device);
22
23
        return $this->get("devices/{$id}/subnets");
24
    }
25
26
    public function addresses($device)
27
    {
28
        $id = get_id_from_variable($device);
29
30
        return $this->get("devices/{$id}/addresses");
31
    }
32
33
    public function create(array $device)
34
    {
35
        return $this->post('devices', $device);
36
    }
37
38
    public function update($device, array $newData)
39
    {
40
        $id = get_id_from_variable($device);
41
42
        return $this->patch("devices/{$id}", $newData);
43
    }
44
45
    public function drop($device)
46
    {
47
        $id = get_id_from_variable($device);
48
49
        return $this->delete("devices/{$id}");
50
    }
51
}
52