GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 3eb280...40da3f )
by Jamie
7s
created

Keypair   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 2
dl 0
loc 63
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 5 1
A create() 0 5 1
A populateFromArray() 0 4 1
A delete() 0 4 1
1
<?php declare (strict_types = 1);
2
3
namespace OpenStack\Compute\v2\Models;
4
5
use OpenCloud\Common\Resource\Creatable;
6
use OpenCloud\Common\Resource\OperatorResource;
7
use OpenCloud\Common\Resource\Deletable;
8
use OpenCloud\Common\Resource\Listable;
9
use OpenCloud\Common\Resource\Retrievable;
10
use OpenCloud\Common\Transport\Utils;
11
12
/**
13
 * Represents a Compute v2 Keypair
14
 *
15
 * @property \OpenStack\Compute\v2\Api $api
16
 */
17
class Keypair extends OperatorResource implements Listable, Retrievable, Deletable, Creatable
18
{
19
    /** @var string */
20
    public $fingerprint;
21
22
    /** @var string */
23
    public $name;
24
25
    /** @var string */
26
    public $publicKey;
27
28
    /** @var  boolean */
29
    public $deleted;
30
31
    /** @var  string */
32
    public $userId;
33
34
    /** @var  string */
35
    public $id;
36
37
    /** @var \DateTimeImmutable */
38
    public $createdAt;
39
    
40
    protected $aliases = [
41
        'public_key' => 'publicKey',
42
        'user_id'    => 'userId',
43
        'created_at' => 'createdAt',
44
    ];
45
46
    protected $resourceKey = 'keypair';
47
    protected $resourcesKey = 'keypairs';
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function retrieve()
53
    {
54
        $response = $this->execute($this->api->getKeypair(), ['name' => (string) $this->name]);
55
        $this->populateFromResponse($response);
56
    }
57
58
    public function create(array $userOptions): Creatable
59
    {
60
        $response = $this->execute($this->api->postKeypair(), $userOptions);
61
        return $this->populateFromResponse($response);
62
    }
63
64
    /**
65
     * {@inheritDoc}
66
     */
67
    public function populateFromArray(array $array): self
68
    {
69
        return parent::populateFromArray(Utils::flattenJson($array, $this->resourceKey));
70
    }
71
72
    /**
73
     * {@inheritDoc}
74
     */
75
    public function delete()
76
    {
77
        $this->execute($this->api->deleteKeypair(), ['name' => (string) $this->name]);
78
    }
79
}
80