ConfigApi::update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 20
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 21
c 0
b 0
f 0
ccs 20
cts 20
cp 1
rs 9.6333
cc 1
nc 1
nop 18
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\Linode;
15
16
use Linode\BaseLinodeApi;
17
18
/**
19
 * This class is autogenerated.
20
 *
21
 * @version Linode API v3.3
22
 */
23
class ConfigApi extends BaseLinodeApi
24
{
25
    /**
26
     * Creates a Linode Configuration Profile.
27
     *
28
     * @param int    $LinodeID               [required]
29
     * @param string $Label                  [required] The Label for this profile
30
     * @param int    $KernelID               [required] The KernelID for this profile.  Found in avail.kernels()
31
     * @param string $DiskList               [required] A comma delimited list of DiskIDs; position reflects device node.  The 9th element for specifying the initrd.
32
     * @param string $RunLevel               [optional] One of 'default', 'single', 'binbash'
33
     * @param int    $RAMLimit               [optional] RAMLimit in MB.  0 for max.
34
     * @param string $virt_mode              [optional] Controls the virtualization mode. One of 'paravirt', 'fullvirt'
35
     * @param int    $RootDeviceNum          [optional] Which device number (1-8) that contains the root partition.  0 to utilize RootDeviceCustom.
36
     * @param string $RootDeviceCustom       [optional] A custom root device setting.
37
     * @param bool   $RootDeviceRO           [optional] Enables the 'ro' kernel flag.  Modern distros want this.
38
     * @param bool   $devtmpfs_automount     [optional] Controls if pv_ops kernels should automount devtmpfs at boot.
39
     * @param bool   $helper_distro          [optional] Enable the Distro filesystem helper.  Corrects fstab and inittab/upstart entries depending on the kernel you're booting.  You want this.
40
     * @param bool   $helper_xen             [optional] Deprecated - use helper_distro.
41
     * @param bool   $helper_disableUpdateDB [optional] Enable the disableUpdateDB filesystem helper
42
     * @param bool   $helper_depmod          [optional] Creates an empty modprobe file for the kernel you're booting.
43
     * @param bool   $helper_network         [optional] Automatically creates network configuration files for your distro and places them into your filesystem.
44
     * @param string $Comments               [optional] Comments you wish to save along with this profile
45
     *
46
     * @return array
47
     */
48 1
    public function create($LinodeID, $Label, $KernelID, $DiskList, $RunLevel = null, $RAMLimit = null, $virt_mode = null, $RootDeviceNum = null, $RootDeviceCustom = null, $RootDeviceRO = null, $devtmpfs_automount = null, $helper_distro = null, $helper_xen = null, $helper_disableUpdateDB = null, $helper_depmod = null, $helper_network = null, $Comments = null)
49
    {
50 1
        return $this->call('linode.config.create', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...omments' => $Comments)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
51 1
            'LinodeID'               => $LinodeID,
52 1
            'Label'                  => $Label,
53 1
            'KernelID'               => $KernelID,
54 1
            'DiskList'               => $DiskList,
55 1
            'RunLevel'               => $RunLevel,
56 1
            'RAMLimit'               => $RAMLimit,
57 1
            'virt_mode'              => $virt_mode,
58 1
            'RootDeviceNum'          => $RootDeviceNum,
59 1
            'RootDeviceCustom'       => $RootDeviceCustom,
60 1
            'RootDeviceRO'           => $RootDeviceRO,
61 1
            'devtmpfs_automount'     => $devtmpfs_automount,
62 1
            'helper_distro'          => $helper_distro,
63 1
            'helper_xen'             => $helper_xen,
64 1
            'helper_disableUpdateDB' => $helper_disableUpdateDB,
65 1
            'helper_depmod'          => $helper_depmod,
66 1
            'helper_network'         => $helper_network,
67 1
            'Comments'               => $Comments,
68
        ]);
69
    }
70
71
    /**
72
     * Deletes a Linode Configuration Profile.
73
     *
74
     * @param int $LinodeID [required]
75
     * @param int $ConfigID [required]
76
     *
77
     * @return array
78
     */
79 1
    public function delete($LinodeID, $ConfigID)
80
    {
81 1
        return $this->call('linode.config.delete', [
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...
82 1
            'LinodeID' => $LinodeID,
83 1
            'ConfigID' => $ConfigID,
84
        ]);
85
    }
86
87
    /**
88
     * Lists a Linode's Configuration Profiles.
89
     *
90
     * @param int $LinodeID [required]
91
     * @param int $ConfigID [optional]
92
     *
93
     * @return array
94
     */
95 1
    public function getList($LinodeID, $ConfigID = null)
96
    {
97 1
        return $this->call('linode.config.list', [
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...
98 1
            'LinodeID' => $LinodeID,
99 1
            'ConfigID' => $ConfigID,
100
        ]);
101
    }
102
103
    /**
104
     * Updates a Linode Configuration Profile.
105
     *
106
     * @param int    $LinodeID               [optional]
107
     * @param int    $ConfigID               [required]
108
     * @param string $Label                  [optional] The Label for this profile
109
     * @param int    $KernelID               [optional] The KernelID for this profile.  Found in avail.kernels()
110
     * @param string $DiskList               [optional] A comma delimited list of DiskIDs; position reflects device node.  The 9th element for specifying the initrd.
111
     * @param string $RunLevel               [optional] One of 'default', 'single', 'binbash'
112
     * @param int    $RAMLimit               [optional] RAMLimit in MB.  0 for max.
113
     * @param string $virt_mode              [optional] Controls the virtualization mode. One of 'paravirt', 'fullvirt'
114
     * @param int    $RootDeviceNum          [optional] Which device number (1-8) that contains the root partition.  0 to utilize RootDeviceCustom.
115
     * @param string $RootDeviceCustom       [optional] A custom root device setting.
116
     * @param bool   $RootDeviceRO           [optional] Enables the 'ro' kernel flag.  Modern distros want this.
117
     * @param bool   $devtmpfs_automount     [optional] Controls if pv_ops kernels should automount devtmpfs at boot.
118
     * @param bool   $helper_distro          [optional] Enable the Distro filesystem helper.  Corrects fstab and inittab/upstart entries depending on the kernel you're booting.  You want this.
119
     * @param bool   $helper_xen             [optional] Deprecated - use helper_distro.
120
     * @param bool   $helper_disableUpdateDB [optional] Enable the disableUpdateDB filesystem helper
121
     * @param bool   $helper_depmod          [optional] Creates an empty modprobe file for the kernel you're booting.
122
     * @param bool   $helper_network         [optional] Automatically creates network configuration files for your distro and places them into your filesystem.
123
     * @param string $Comments               [optional] Comments you wish to save along with this profile
124
     *
125
     * @return array
126
     */
127 1
    public function update($LinodeID, $ConfigID, $Label = null, $KernelID = null, $DiskList = null, $RunLevel = null, $RAMLimit = null, $virt_mode = null, $RootDeviceNum = null, $RootDeviceCustom = null, $RootDeviceRO = null, $devtmpfs_automount = null, $helper_distro = null, $helper_xen = null, $helper_disableUpdateDB = null, $helper_depmod = null, $helper_network = null, $Comments = null)
128
    {
129 1
        return $this->call('linode.config.update', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('lino...omments' => $Comments)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
130 1
            'LinodeID'               => $LinodeID,
131 1
            'ConfigID'               => $ConfigID,
132 1
            'Label'                  => $Label,
133 1
            'KernelID'               => $KernelID,
134 1
            'DiskList'               => $DiskList,
135 1
            'RunLevel'               => $RunLevel,
136 1
            'RAMLimit'               => $RAMLimit,
137 1
            'virt_mode'              => $virt_mode,
138 1
            'RootDeviceNum'          => $RootDeviceNum,
139 1
            'RootDeviceCustom'       => $RootDeviceCustom,
140 1
            'RootDeviceRO'           => $RootDeviceRO,
141 1
            'devtmpfs_automount'     => $devtmpfs_automount,
142 1
            'helper_distro'          => $helper_distro,
143 1
            'helper_xen'             => $helper_xen,
144 1
            'helper_disableUpdateDB' => $helper_disableUpdateDB,
145 1
            'helper_depmod'          => $helper_depmod,
146 1
            'helper_network'         => $helper_network,
147 1
            'Comments'               => $Comments,
148
        ]);
149
    }
150
}
151