LinodeApi::update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 23
c 0
b 0
f 0
ccs 22
cts 22
cp 1
rs 9.584
cc 1
nc 1
nop 20
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 LinodeApi extends BaseLinodeApi
22
{
23
    /**
24
     * Issues a boot job for the provided ConfigID.  If no ConfigID is provided boots the last used
25
     * configuration profile, or the first configuration profile if this Linode has never been booted.
26
     *
27
     * @param int $LinodeID [required]
28
     * @param int $ConfigID [optional] The ConfigID to boot, available from linode.config.list().
29
     *
30
     * @return array
31
     */
32 1
    public function boot($LinodeID, $ConfigID = null)
33
    {
34 1
        return $this->call('linode.boot', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...onfigID' => $ConfigID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
35 1
            'LinodeID' => $LinodeID,
36 1
            'ConfigID' => $ConfigID,
37
        ]);
38
    }
39
40
    /**
41
     * Creates a Linode and assigns you full privileges. There is a 250-linodes-per-hour limiter.
42
     *
43
     * @param int $DatacenterID [required] The DatacenterID from avail.datacenters() where you wish to place this new Linode
44
     * @param int $PlanID       [required] The desired PlanID available from avail.LinodePlans()
45
     * @param int $PaymentTerm  [optional] Subscription term in months for prepaid customers.  One of: 1, 12, or 24
46
     *
47
     * @return array
48
     */
49 2
    public function create($DatacenterID, $PlanID, $PaymentTerm = null)
50
    {
51 2
        return $this->call('linode.create', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...Term' => $PaymentTerm)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
52 2
            'DatacenterID' => $DatacenterID,
53 2
            'PlanID'       => $PlanID,
54 2
            'PaymentTerm'  => $PaymentTerm,
55
        ]);
56
    }
57
58
    /**
59
     * Immediately removes a Linode from your account and issues a pro-rated credit back to your account,
60
     * if applicable.  To prevent accidental deletes, this requires the Linode has no Disk images.  You
61
     * must first delete its disk images.".
62
     *
63
     * @param int  $LinodeID   [required] The LinodeID to delete
64
     * @param bool $skipChecks [optional] Skips the safety checks and will always delete the Linode
65
     *
66
     * @return array
67
     */
68 1
    public function delete($LinodeID, $skipChecks = null)
69
    {
70 1
        return $this->call('linode.delete', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...hecks' => $skipChecks)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
71 1
            'LinodeID'   => $LinodeID,
72 1
            'skipChecks' => $skipChecks,
73
        ]);
74
    }
75
76
    /**
77
     * Creates a new Linode, assigns you full privileges, and then clones the specified LinodeID to the new
78
     * Linode. There is a limit of 5 active clone operations per source Linode.  It is recommended that the
79
     * source Linode be powered down during the clone.
80
     *
81
     * @param int $LinodeID     [required] The LinodeID that you want cloned
82
     * @param int $DatacenterID [required] The DatacenterID from avail.datacenters() where you wish to place this new Linode
83
     * @param int $PlanID       [required] The desired PlanID available from avail.LinodePlans()
84
     * @param int $PaymentTerm  [optional] Subscription term in months for prepaid customers.  One of: 1, 12, or 24
85
     *
86
     * @return array
87
     */
88 1
    public function duplicate($LinodeID, $DatacenterID, $PlanID, $PaymentTerm = null)
89
    {
90 1
        return $this->call('linode.clone', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...Term' => $PaymentTerm)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
91 1
            'LinodeID'     => $LinodeID,
92 1
            'DatacenterID' => $DatacenterID,
93 1
            'PlanID'       => $PlanID,
94 1
            'PaymentTerm'  => $PaymentTerm,
95
        ]);
96
    }
97
98
    /**
99
     * Returns a list of all Linodes user has access or delete to, including some properties.  Status
100
     * values are -1: Being Created, 0: Brand New, 1: Running, and 2: Powered Off.
101
     *
102
     * @param int $LinodeID [optional] Limits the list to the specified LinodeID
103
     *
104
     * @return array
105
     */
106 1
    public function getList($LinodeID = null)
107
    {
108 1
        return $this->call('linode.list', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...inodeID' => $LinodeID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
109 1
            'LinodeID' => $LinodeID,
110
        ]);
111
    }
112
113
    /**
114
     * Changes a Linode's hypervisor from Xen to KVM.
115
     *
116
     * @param int $LinodeID [required] The LinodeID to migrate to KVM.
117
     *
118
     * @return array
119
     */
120 1
    public function kvmify($LinodeID)
121
    {
122 1
        return $this->call('linode.kvmify', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...inodeID' => $LinodeID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
123 1
            'LinodeID' => $LinodeID,
124
        ]);
125
    }
126
127
    /**
128
     * Upgrades a Linode to its next generation.
129
     *
130
     * @param int $LinodeID [required]
131
     *
132
     * @return array
133
     */
134 1
    public function mutate($LinodeID)
135
    {
136 1
        return $this->call('linode.mutate', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...inodeID' => $LinodeID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
137 1
            'LinodeID' => $LinodeID,
138
        ]);
139
    }
140
141
    /**
142
     * Issues a shutdown, and then boot job for a given LinodeID.
143
     *
144
     * @param int $LinodeID [required]
145
     * @param int $ConfigID [optional]
146
     *
147
     * @return array
148
     */
149 1
    public function reboot($LinodeID, $ConfigID = null)
150
    {
151 1
        return $this->call('linode.reboot', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...onfigID' => $ConfigID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
152 1
            'LinodeID' => $LinodeID,
153 1
            'ConfigID' => $ConfigID,
154
        ]);
155
    }
156
157
    /**
158
     * Resizes a Linode from one plan to another.  Immediately shuts the Linode down, charges/credits the
159
     * account, and issue a migration to another host server.
160
     *
161
     * @param int $LinodeID [required]
162
     * @param int $PlanID   [required] The desired PlanID available from avail.LinodePlans()
163
     *
164
     * @return array
165
     */
166 1
    public function resize($LinodeID, $PlanID)
167
    {
168 1
        return $this->call('linode.resize', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino..., 'PlanID' => $PlanID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
169 1
            'LinodeID' => $LinodeID,
170 1
            'PlanID'   => $PlanID,
171
        ]);
172
    }
173
174
    /**
175
     * Issues a shutdown job for a given LinodeID.
176
     *
177
     * @param int $LinodeID [required]
178
     *
179
     * @return array
180
     */
181 1
    public function shutdown($LinodeID)
182
    {
183 1
        return $this->call('linode.shutdown', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...inodeID' => $LinodeID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
184 1
            'LinodeID' => $LinodeID,
185
        ]);
186
    }
187
188
    /**
189
     * Updates a Linode's properties.
190
     *
191
     * @param int    $LinodeID                [required]
192
     * @param string $Label                   [optional] This Linode's label
193
     * @param string $lpm_displayGroup        [optional] Display group in the Linode list inside the Linode Manager
194
     * @param bool   $Alert_cpu_enabled       [optional] Enable the cpu usage email alert
195
     * @param int    $Alert_cpu_threshold     [optional] CPU Alert threshold, percentage 0-800
196
     * @param bool   $Alert_diskio_enabled    [optional] Enable the disk IO email alert
197
     * @param int    $Alert_diskio_threshold  [optional] IO ops/sec
198
     * @param bool   $Alert_bwin_enabled      [optional] Enable the incoming bandwidth email alert
199
     * @param int    $Alert_bwin_threshold    [optional] Mb/sec
200
     * @param bool   $Alert_bwout_enabled     [optional] Enable the outgoing bandwidth email alert
201
     * @param int    $Alert_bwout_threshold   [optional] Mb/sec
202
     * @param bool   $Alert_bwquota_enabled   [optional] Enable the bw quote email alert
203
     * @param int    $Alert_bwquota_threshold [optional] Percentage of monthly bw quota
204
     * @param int    $backupWindow            [optional]
205
     * @param int    $backupWeeklyDay         [optional]
206
     * @param bool   $watchdog                [optional] Enable the Lassie shutdown watchdog
207
     * @param bool   $ms_ssh_disabled         [optional]
208
     * @param string $ms_ssh_user             [optional]
209
     * @param string $ms_ssh_ip               [optional]
210
     * @param int    $ms_ssh_port             [optional]
211
     *
212
     * @return array
213
     */
214 1
    public function update($LinodeID, $Label = null, $lpm_displayGroup = null, $Alert_cpu_enabled = null, $Alert_cpu_threshold = null, $Alert_diskio_enabled = null, $Alert_diskio_threshold = null, $Alert_bwin_enabled = null, $Alert_bwin_threshold = null, $Alert_bwout_enabled = null, $Alert_bwout_threshold = null, $Alert_bwquota_enabled = null, $Alert_bwquota_threshold = null, $backupWindow = null, $backupWeeklyDay = null, $watchdog = null, $ms_ssh_disabled = null, $ms_ssh_user = null, $ms_ssh_ip = null, $ms_ssh_port = null)
215
    {
216 1
        return $this->call('linode.update', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...port' => $ms_ssh_port)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
217 1
            'LinodeID'                => $LinodeID,
218 1
            'Label'                   => $Label,
219 1
            'lpm_displayGroup'        => $lpm_displayGroup,
220 1
            'Alert_cpu_enabled'       => $Alert_cpu_enabled,
221 1
            'Alert_cpu_threshold'     => $Alert_cpu_threshold,
222 1
            'Alert_diskio_enabled'    => $Alert_diskio_enabled,
223 1
            'Alert_diskio_threshold'  => $Alert_diskio_threshold,
224 1
            'Alert_bwin_enabled'      => $Alert_bwin_enabled,
225 1
            'Alert_bwin_threshold'    => $Alert_bwin_threshold,
226 1
            'Alert_bwout_enabled'     => $Alert_bwout_enabled,
227 1
            'Alert_bwout_threshold'   => $Alert_bwout_threshold,
228 1
            'Alert_bwquota_enabled'   => $Alert_bwquota_enabled,
229 1
            'Alert_bwquota_threshold' => $Alert_bwquota_threshold,
230 1
            'backupWindow'            => $backupWindow,
231 1
            'backupWeeklyDay'         => $backupWeeklyDay,
232 1
            'watchdog'                => $watchdog,
233 1
            'ms_ssh_disabled'         => $ms_ssh_disabled,
234 1
            'ms_ssh_user'             => $ms_ssh_user,
235 1
            'ms_ssh_ip'               => $ms_ssh_ip,
236 1
            'ms_ssh_port'             => $ms_ssh_port,
237
        ]);
238
    }
239
240
    /**
241
     * Generates a console token starting a web console LISH session for the requesting IP.
242
     *
243
     * @param int $LinodeID [required]
244
     *
245
     * @return array
246
     */
247 1
    public function webConsoleToken($LinodeID)
248
    {
249 1
        return $this->call('linode.webconsoletoken', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...inodeID' => $LinodeID)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
250 1
            'LinodeID' => $LinodeID,
251
        ]);
252
    }
253
}
254