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

DeviceRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 45
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A subnets() 0 5 1
A index() 0 3 1
A show() 0 5 1
A drop() 0 5 1
A addresses() 0 5 1
A update() 0 5 1
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