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

JobBinaryInternal   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 16.36 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 2
dl 9
loc 55
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A retrieve() 0 5 1
A create() 9 9 1
A delete() 0 4 1
A update() 0 5 1
A downloadData() 0 5 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
use Psr\Http\Message\StreamInterface;
11
12
class JobBinaryInternal extends OperatorResource implements Listable, Retrievable, Creatable, Deletable
13
{
14
    public $name;
15
    public $tenantId;
16
    public $createdAt;
17
    public $updatedAt;
18
    public $isProtected;
19
    public $isPublic;
20
    public $datasize;
21
    public $id;
22
23
    protected $resourceKey = 'job_binary_internal';
24
    protected $resourcesKey = 'binaries';
25
26
    protected $aliases = [
27
        'tenant_id'    => 'tenantId',
28
        'created_at'   => 'createdAt',
29
        'updated_at'   => 'updatedAt',
30
        'is_protected' => 'isProtected',
31
        'is_public'    => 'isPublic',
32
    ];
33
34
    public function retrieve()
35
    {
36
        $response = $this->execute($this->api->getJobBinaryInternal(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method getJobBinaryInternal() 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 View Code Duplication
    public function create(array $userOptions): Creatable
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...
41
    {
42
        $options = array_merge($userOptions, [
43
      'contentType' => 'application/octet-stream',
44
    ]);
45
        $response = $this->execute($this->api->putJobBinaryInternal(), $options);
0 ignored issues
show
Bug introduced by
The method putJobBinaryInternal() 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...
46
47
        return $this->populateFromResponse($response);
48
    }
49
50
    public function delete()
51
    {
52
        $this->execute($this->api->deleteJobBinaryInternal(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method deleteJobBinaryInternal() 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...
53
    }
54
55
    public function update()
56
    {
57
        $response = $this->execute($this->api->patchJobBinaryInternal(), $this->getAttrs(['id', 'name', 'isProtected', 'isPublic']));
0 ignored issues
show
Bug introduced by
The method patchJobBinaryInternal() 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...
58
        $this->populateFromResponse($response);
59
    }
60
61
    public function downloadData(): StreamInterface
62
    {
63
        $response = $this->executeWithState($this->api->getJobBinaryInternalData());
0 ignored issues
show
Bug introduced by
The method getJobBinaryInternalData() 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...
64
        return $response->getBody();
65
    }
66
}
67