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
Pull Request — master (#157)
by
unknown
01:44
created

Image   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 20.59 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 1
cbo 1
dl 14
loc 68
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 5 1
A delete() 0 4 1
A update() 0 5 1
A register() 0 6 1
A unregister() 0 4 1
A addTags() 7 7 1
A removeTags() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace OpenStack\DataProcessing\v1\Models;
4
5
use OpenStack\Common\Resource\Creatable;
6
use OpenStack\Common\Resource\Deletable;
7
use OpenStack\Common\Resource\Listable;
8
use OpenStack\Common\Resource\OperatorResource;
9
use OpenStack\Common\Resource\Retrievable;
10
11
class Image extends OperatorResource implements Listable, Retrievable, Deletable
12
{
13
    public $status;
14
    public $username;
15
    public $updated;
16
    public $OSEXTIMGSIZEsize;
17
    public $created;
18
    public $tags;
19
    public $minDisk;
20
    public $name;
21
    public $progress;
22
    public $minRam;
23
    public $metadata;
24
    public $id;
25
    public $description;
26
27
    protected $resourceKey = 'image';
28
    protected $resourcesKey = 'images';
29
30
    protected $aliases = [
31
        'OS-EXT-IMG-SIZE:size' => 'OSEXTIMGSIZEsize',
32
    ];
33
34
    public function retrieve()
35
    {
36
        $response = $this->execute($this->api->getImage(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method getImage() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
        $this->populateFromResponse($response);
38
    }
39
40
    public function delete()
41
    {
42
        $this->execute($this->api->deleteImage(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method deleteImage() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
    }
44
45
    public function update()
46
    {
47
        $response = $this->execute($this->api->patchImage(), $this->getAttrs(['id', 'description', 'name', 'isPublic', 'isProtected']));
0 ignored issues
show
Bug introduced by
The method patchImage() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
        $this->populateFromResponse($response);
49
    }
50
51
    public function register(array $userOptions)
52
    {
53
        $response = $this->execute($this->api->postImage(), array_merge($this->getAttrs(['id']), $userOptions));
0 ignored issues
show
Bug introduced by
The method postImage() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
54
55
        return $this->populateFromResponse($response);
56
    }
57
58
    public function unregister()
59
    {
60
        $this->execute($this->api->deleteImage(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method deleteImage() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
    }
62
63 View Code Duplication
    public function addTags(array $userOptions)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
64
    {
65
        $options = array_merge($this->getAttrs(['id']), $userOptions);
66
        $response = $this->execute($this->api->postImageTag(), $options);
0 ignored issues
show
Bug introduced by
The method postImageTag() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
67
68
        return $this->populateFromResponse($response);
69
    }
70
71 View Code Duplication
    public function removeTags(array $userOptions)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
72
    {
73
        $options = array_merge($this->getAttrs(['id']), $userOptions);
74
        $response = $this->execute($this->api->unPostImageTag(), $options);
0 ignored issues
show
Bug introduced by
The method unPostImageTag() does not seem to exist on object<OpenStack\Common\Api\ApiInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
75
76
        return $this->populateFromResponse($response);
77
    }
78
}
79