Completed
Pull Request — master (#34)
by Adam
03:27
created

Ides   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 66
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 6 1
A delete() 0 4 1
A get() 0 6 1
A create() 0 11 1
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Connector\ClientInterface;
6
use AcquiaCloudApi\Response\IdesResponse;
7
use AcquiaCloudApi\Response\IdeResponse;
8
use AcquiaCloudApi\Response\OperationResponse;
9
10
/**
11
 * Class Ides
12
 * @package AcquiaCloudApi\CloudApi
13
 */
14
class Ides extends CloudApiBase implements CloudApiInterface
15
{
16
17
    /**
18
     * Returns a list of remote IDEs.
19
     *
20
     * @param string $applicationUuid The application ID
21
     * @return IdesResponse
22
     */
23
    public function getAll($applicationUuid)
24
    {
25
        return new IdesResponse(
26
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...pplicationUuid.'/ides') can also be of type object; however, parameter $ides of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
27
                'get',
28
                "/applications/${applicationUuid}/ides"
29
            )
30
        );
31
    }
32
33
    /**
34
     * Get remote IDE info.
35
     *
36
     * @param string $ideUuid The Remote IDE universally unique identifier.
37
     * @return IdeResponse
38
     */
39
    public function get($ideUuid)
40
    {
41
        return new IdeResponse(
42
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('get', '/ides/'.$ideUuid) can also be of type array; however, parameter $ide of AcquiaCloudApi\Response\IdeResponse::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
43
                'get',
44
                "/ides/${ideUuid}"
45
            )
46
        );
47
    }
48
49
    /**
50
     * Creates a new remote IDE.
51
     *
52
     * @param string $applicationUuid
53
     * @param string $name
54
     * @return OperationResponse
55
     */
56
    public function create($applicationUuid, $name)
57
    {
58
59
        $options = [
60
            'form_params' => [
61
                'name' => $name,
62
            ],
63
        ];
64
65
        return new OperationResponse(
66
            $this->client->request('post', "/applications/${applicationUuid}/ides", $options)
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...Uuid.'/ides', $options) can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

66
            /** @scrutinizer ignore-type */ $this->client->request('post', "/applications/${applicationUuid}/ides", $options)
Loading history...
67
        );
68
    }
69
70
    /**
71
     * De-provisions a specific Remote IDE.
72
     *
73
     * @param string $ideUuid
74
     * @return OperationResponse
75
     */
76
    public function delete($ideUuid)
0 ignored issues
show
Unused Code introduced by
The parameter $ideUuid is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

76
    public function delete(/** @scrutinizer ignore-unused */ $ideUuid)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
77
    {
78
        return new OperationResponse(
79
            $this->client->request('delete', "/ides/{ideUuid}")
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...te', '/ides/{ideUuid}') can also be of type array; however, parameter $operation of AcquiaCloudApi\Response\...Response::__construct() does only seem to accept object, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

79
            /** @scrutinizer ignore-type */ $this->client->request('delete', "/ides/{ideUuid}")
Loading history...
80
        );
81
    }
82
}
83