DomainApi::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 15
c 0
b 0
f 0
ccs 14
cts 14
cp 1
rs 9.8333
cc 1
nc 1
nop 12
crap 1

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

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;
15
16
/**
17
 * This class is autogenerated.
18
 *
19
 * @version Linode API v3.3
20
 */
21
class DomainApi extends BaseLinodeApi
22
{
23
    /**
24
     * Create a domain record.
25
     *
26
     * @param string $Domain           [required] The zone's name
27
     * @param string $Type             [required] master or slave
28
     * @param string $SOA_Email        [optional] Required when type=master
29
     * @param string $Description      [optional] Currently undisplayed.
30
     * @param int    $Refresh_sec      [optional]
31
     * @param int    $Retry_sec        [optional]
32
     * @param int    $Expire_sec       [optional]
33
     * @param int    $TTL_sec          [optional]
34
     * @param string $lpm_displayGroup [optional] Display group in the Domain list inside the Linode DNS Manager
35
     * @param int    $status           [optional] 0, 1, or 2 (disabled, active, edit mode)
36
     * @param string $master_ips       [optional] When type=slave, the zone's master DNS servers list, semicolon separated
37
     * @param string $axfr_ips         [optional] IP addresses allowed to AXFR the entire zone, semicolon separated
38
     *
39
     * @return array
40
     */
41 1
    public function create($Domain, $Type, $SOA_Email = null, $Description = null, $Refresh_sec = null, $Retry_sec = null, $Expire_sec = null, $TTL_sec = null, $lpm_displayGroup = null, $status = null, $master_ips = null, $axfr_ips = null)
42
    {
43 1
        return $this->call('domain.create', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...xfr_ips' => $axfr_ips)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
44 1
            'Domain'           => $Domain,
45 1
            'Type'             => $Type,
46 1
            'SOA_Email'        => $SOA_Email,
47 1
            'Description'      => $Description,
48 1
            'Refresh_sec'      => $Refresh_sec,
49 1
            'Retry_sec'        => $Retry_sec,
50 1
            'Expire_sec'       => $Expire_sec,
51 1
            'TTL_sec'          => $TTL_sec,
52 1
            'lpm_displayGroup' => $lpm_displayGroup,
53 1
            'status'           => $status,
54 1
            'master_ips'       => $master_ips,
55 1
            'axfr_ips'         => $axfr_ips,
56
        ]);
57
    }
58
59
    /**
60
     * @param int $DomainID [required]
61
     *
62
     * @return array
63
     */
64 1
    public function delete($DomainID)
65
    {
66 1
        return $this->call('domain.delete', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...omainID' => $DomainID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
67 1
            'DomainID' => $DomainID,
68
        ]);
69
    }
70
71
    /**
72
     * Lists domains you have access to.
73
     *
74
     * @param int $DomainID [optional] Limits the list to the specified DomainID
75
     *
76
     * @return array
77
     */
78 1
    public function getList($DomainID = null)
79
    {
80 1
        return $this->call('domain.list', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...omainID' => $DomainID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
81 1
            'DomainID' => $DomainID,
82
        ]);
83
    }
84
85
    /**
86
     * Update a domain record.
87
     *
88
     * @param int    $DomainID         [required]
89
     * @param string $Domain           [optional] The zone's name
90
     * @param string $Type             [optional] master or slave
91
     * @param string $SOA_Email        [optional] Required when type=master
92
     * @param string $Description      [optional] Currently undisplayed.
93
     * @param int    $Refresh_sec      [optional]
94
     * @param int    $Retry_sec        [optional]
95
     * @param int    $Expire_sec       [optional]
96
     * @param int    $TTL_sec          [optional]
97
     * @param string $lpm_displayGroup [optional] Display group in the Domain list inside the Linode DNS Manager
98
     * @param int    $status           [optional] 0, 1, or 2 (disabled, active, edit mode)
99
     * @param string $master_ips       [optional] When type=slave, the zone's master DNS servers list, semicolon separated
100
     * @param string $axfr_ips         [optional] IP addresses allowed to AXFR the entire zone, semicolon separated
101
     *
102
     * @return array
103
     */
104 1
    public function update($DomainID, $Domain = null, $Type = null, $SOA_Email = null, $Description = null, $Refresh_sec = null, $Retry_sec = null, $Expire_sec = null, $TTL_sec = null, $lpm_displayGroup = null, $status = null, $master_ips = null, $axfr_ips = null)
105
    {
106 1
        return $this->call('domain.update', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('doma...xfr_ips' => $axfr_ips)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
107 1
            'DomainID'         => $DomainID,
108 1
            'Domain'           => $Domain,
109 1
            'Type'             => $Type,
110 1
            'SOA_Email'        => $SOA_Email,
111 1
            'Description'      => $Description,
112 1
            'Refresh_sec'      => $Refresh_sec,
113 1
            'Retry_sec'        => $Retry_sec,
114 1
            'Expire_sec'       => $Expire_sec,
115 1
            'TTL_sec'          => $TTL_sec,
116 1
            'lpm_displayGroup' => $lpm_displayGroup,
117 1
            'status'           => $status,
118 1
            'master_ips'       => $master_ips,
119 1
            'axfr_ips'         => $axfr_ips,
120
        ]);
121
    }
122
}
123