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

Job::getJobTypes()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 19
rs 8.8571
cc 5
eloc 12
nc 16
nop 1
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 OpenStack\Common\Transport\Utils;
11
12
class Job extends OperatorResource implements Listable, Retrievable, Creatable, Deletable
13
{
14
    public $description;
15
    public $tenantId;
16
    public $createdAt;
17
    public $mains;
18
    public $updatedAt;
19
    public $libs;
20
    public $isProtected;
21
    public $interface;
22
    public $type;
23
    public $isPublic;
24
    public $id;
25
    public $name;
26
27
    protected $resourceKey = 'job';
28
    protected $resourcesKey = 'jobs';
29
30
    protected $aliases = [
31
        'created_at'   => 'createdAt',
32
        'updated_at'   => 'updatedAt',
33
        'is_protected' => 'isProtected',
34
        'tenant_id'    => 'tenantId',
35
        'is_public'    => 'isPublic',
36
    ];
37
38
    public function retrieve()
39
    {
40
        $response = $this->execute($this->api->getJob(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method getJob() 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...
41
        $this->populateFromResponse($response);
42
    }
43
44
    public function create(array $userOptions): Creatable
45
    {
46
        $response = $this->execute($this->api->postJob(), $userOptions);
0 ignored issues
show
Bug introduced by
The method postJob() 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...
47
48
        return $this->populateFromResponse($response);
49
    }
50
51
    public function delete()
52
    {
53
        $this->execute($this->api->deleteJob(), $this->getAttrs(['id']));
0 ignored issues
show
Bug introduced by
The method deleteJob() 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
56
    public function update()
57
    {
58
        $response = $this->execute($this->api->patchJob(), $this->getAttrs(['id', 'name', 'isPublic', 'description', 'isProtected']));
0 ignored issues
show
Bug introduced by
The method patchJob() 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...
59
        $this->populateFromResponse($response);
60
    }
61
62
    public function executeJob(array $options)
63
    {
64
        $response = $this->execute($this->api->executeJob(), $options);
0 ignored issues
show
Bug introduced by
The method executeJob() 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...
65
66
        return $this->model(JobExecution::class)->populateFromResponse($response);
67
    }
68
69
    public function getJobTypes(array $options = []): array
70
    {
71
        $path = '';
72
        if ($options !== []) {
73
            $path .= '?';
74
        }
75
        if (array_key_exists('plugin', $options)) {
76
            $path .= '&plugin={plugin}';
77
        }
78
        if (array_key_exists('version', $options)) {
79
            $path .= '&version={version}';
80
        }
81
        if (array_key_exists('hints', $options)) {
82
            $path .= '&hints={hints}';
83
        }
84
        $response = $this->execute($this->api->getJobTypes($path), $options);
0 ignored issues
show
Bug introduced by
The method getJobTypes() 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...
85
86
        return Utils::jsonDecode($response);
87
    }
88
}
89