UserApi   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 23
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getApiKey() 0 8 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;
15
16
/**
17
 * This class is autogenerated.
18
 *
19
 * @version Linode API v3.3
20
 */
21
class UserApi extends BaseLinodeApi
22
{
23
    /**
24
     * Authenticates a Linode Manager user against their username, password, and two-factor token (when
25
     * enabled), and then returns a new API key, which can be used until it expires.  The number of active
26
     * keys is limited to 20.  Batch requests will be rejected if they include this API action.
27
     *
28
     * @param string $username [required]
29
     * @param string $password [required]
30
     * @param string $token    [optional] Required when two-factor authentication is enabled. Emergency scratch codes are not permitted.
31
     * @param int    $expires  [optional] Number of hours the key will remain valid, between 0 and 8760. 0 means no expiration. Defaults to 168.
32
     * @param string $label    [optional] An optional label for this key.
33
     *
34
     * @return array
35
     */
36 1
    public function getApiKey($username, $password, $token = null, $expires = null, $label = null)
37
    {
38 1
        return $this->call('user.getapikey', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->call('user...es, 'label' => $label)) returns the type boolean which is incompatible with the documented return type array.
Loading history...
39 1
            'username' => $username,
40 1
            'password' => $password,
41 1
            'token'    => $token,
42 1
            'expires'  => $expires,
43 1
            'label'    => $label,
44
        ]);
45
    }
46
}
47