Completed
Push — master ( 40e591...8b2a4b )
by Alex
03:04
created

SubnetRequest   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 73
rs 10
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 5 1
A freeSubnets() 0 5 1
A slaves() 0 5 1
A freeSubnet() 0 5 1
A byCidr() 0 3 1
A slavesRecursive() 0 5 1
A addresses() 0 5 1
A ip() 0 5 1
A customFields() 0 3 1
A usage() 0 5 1
A freeAddress() 0 5 1
1
<?php
2
3
namespace Axsor\PhpIPAM\Http\Requests;
4
5
class SubnetRequest extends Connector
6
{
7
    public function show($subnet)
8
    {
9
        $id = get_id_from_variable($subnet);
10
11
        return $this->get("subnets/{$id}");
12
    }
13
14
    public function usage($subnet)
15
    {
16
        $id = get_id_from_variable($subnet);
17
18
        return $this->get("subnets/{$id}/usage");
19
    }
20
21
    public function freeAddress($subnet)
22
    {
23
        $id = get_id_from_variable($subnet);
24
25
        return $this->get("subnets/{$id}/first_free");
26
    }
27
28
    public function slaves($subnet)
29
    {
30
        $id = get_id_from_variable($subnet);
31
32
        return $this->get("subnets/{$id}/slaves");
33
    }
34
35
    public function slavesRecursive($subnet)
36
    {
37
        $id = get_id_from_variable($subnet);
38
39
        return $this->get("subnets/{$id}/slaves_recursive");
40
    }
41
42
    public function addresses($subnet)
43
    {
44
        $id = get_id_from_variable($subnet);
45
46
        return $this->get("subnets/{$id}/addresses");
47
    }
48
49
    public function ip($subnet, string $ip)
50
    {
51
        $id = get_id_from_variable($subnet);
52
53
        return $this->get("subnets/{$id}/addresses/{$ip}");
54
    }
55
56
    public function freeSubnet($subnet, int $mask)
57
    {
58
        $id = get_id_from_variable($subnet);
59
60
        return $this->get("subnets/{$id}/first_subnet/{$mask}");
61
    }
62
63
    public function freeSubnets($subnet, int $mask)
64
    {
65
        $id = get_id_from_variable($subnet);
66
67
        return $this->get("subnets/{$id}/all_subnets/{$mask}");
68
    }
69
70
    public function customFields()
71
    {
72
        return $this->get("subnets/custom_fields");
73
    }
74
75
    public function byCidr(string $cidr)
76
    {
77
        return $this->get("subnets/cidr/{$cidr}");
78
    }
79
}
80