ResourceApi   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 29
dl 0
loc 91
c 0
b 0
f 0
ccs 32
cts 32
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 13 1
A getList() 0 5 1
A create() 0 13 1
A delete() 0 5 1
1
<?php
2
3
//----------------------------------------------------------------------
4
//
5
//  Copyright (C) 2015-2017 Artem Rodygin
6
//
7
//  This file is part of Linode API Client Library for PHP.
8
//
9
//  You should have received a copy of the MIT License along with
10
//  the library. If not, see <http://opensource.org/licenses/MIT>.
11
//
12
//----------------------------------------------------------------------
13
14
namespace Linode\Domain;
15
16
use Linode\BaseLinodeApi;
17
18
/**
19
 * This class is autogenerated.
20
 *
21
 * @version Linode API v3.3
22
 */
23
class ResourceApi extends BaseLinodeApi
24
{
25
    /**
26
     * Create a domain record.
27
     *
28
     * @param int    $DomainID [required]
29
     * @param string $Type     [required] One of: NS, MX, A, AAAA, CNAME, TXT, SRV or CAA
30
     * @param string $Name     [optional] The hostname or FQDN.  When Type=MX the subdomain to delegate to the Target MX server.
31
     * @param string $Target   [optional] When Type=MX the hostname.  When Type=CNAME the target of the alias.  When Type=TXT or CAA the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.
32
     * @param int    $Priority [optional] Priority for MX and SRV records, 0-65535
33
     * @param int    $Weight   [optional]
34
     * @param int    $Port     [optional]
35
     * @param string $Protocol [optional] The protocol to append to an SRV record.  Ignored on other record types.
36
     * @param string $Tag      [optional] The tag attribute for a CAA record.  One of issue, issuewild, iodef.  Ignored on other record types.
37
     * @param int    $TTL_sec  [optional] TTL.  Leave as 0 to accept our default.
38
     *
39
     * @return array
40
     */
41 1
    public function create($DomainID, $Type, $Name = null, $Target = null, $Priority = null, $Weight = null, $Port = null, $Protocol = null, $Tag = null, $TTL_sec = null)
42
    {
43 1
        return $this->call('domain.resource.create', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...'TTL_sec' => $TTL_sec)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
44 1
            'DomainID' => $DomainID,
45 1
            'Type'     => $Type,
46 1
            'Name'     => $Name,
47 1
            'Target'   => $Target,
48 1
            'Priority' => $Priority,
49 1
            'Weight'   => $Weight,
50 1
            'Port'     => $Port,
51 1
            'Protocol' => $Protocol,
52 1
            'Tag'      => $Tag,
53 1
            'TTL_sec'  => $TTL_sec,
54
        ]);
55
    }
56
57
    /**
58
     * @param int $DomainID   [required]
59
     * @param int $ResourceID [required]
60
     *
61
     * @return array
62
     */
63 1
    public function delete($DomainID, $ResourceID)
64
    {
65 1
        return $this->call('domain.resource.delete', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...rceID' => $ResourceID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
66 1
            'DomainID'   => $DomainID,
67 1
            'ResourceID' => $ResourceID,
68
        ]);
69
    }
70
71
    /**
72
     * @param int $DomainID   [required]
73
     * @param int $ResourceID [optional]
74
     *
75
     * @return array
76
     */
77 1
    public function getList($DomainID, $ResourceID = null)
78
    {
79 1
        return $this->call('domain.resource.list', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...rceID' => $ResourceID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
80 1
            'DomainID'   => $DomainID,
81 1
            'ResourceID' => $ResourceID,
82
        ]);
83
    }
84
85
    /**
86
     * Update a domain record.
87
     *
88
     * @param int    $DomainID   [optional]
89
     * @param int    $ResourceID [required]
90
     * @param string $Name       [optional] The hostname or FQDN.  When Type=MX the subdomain to delegate to the Target MX server.
91
     * @param string $Target     [optional] When Type=MX the hostname.  When Type=CNAME the target of the alias.  When Type=TXT or CAA the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.
92
     * @param int    $Priority   [optional] Priority for MX and SRV records, 0-65535
93
     * @param int    $Weight     [optional]
94
     * @param int    $Port       [optional]
95
     * @param string $Protocol   [optional] The protocol to append to an SRV record.  Ignored on other record types.
96
     * @param string $Tag        [optional] The tag attribute for a CAA record.  One of issue, issuewild, iodef.  Ignored on other record types.
97
     * @param int    $TTL_sec    [optional] TTL.  Leave as 0 to accept our default.
98
     *
99
     * @return array
100
     */
101 1
    public function update($DomainID, $ResourceID, $Name = null, $Target = null, $Priority = null, $Weight = null, $Port = null, $Protocol = null, $Tag = null, $TTL_sec = null)
102
    {
103 1
        return $this->call('domain.resource.update', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...'TTL_sec' => $TTL_sec)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
104 1
            'DomainID'   => $DomainID,
105 1
            'ResourceID' => $ResourceID,
106 1
            'Name'       => $Name,
107 1
            'Target'     => $Target,
108 1
            'Priority'   => $Priority,
109 1
            'Weight'     => $Weight,
110 1
            'Port'       => $Port,
111 1
            'Protocol'   => $Protocol,
112 1
            'Tag'        => $Tag,
113 1
            'TTL_sec'    => $TTL_sec,
114
        ]);
115
    }
116
}
117