Servers::getAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Response\OperationResponse;
6
use AcquiaCloudApi\Response\ServerResponse;
7
use AcquiaCloudApi\Response\ServersResponse;
8
9
/**
10
 * Class Servers
11
 *
12
 * @package AcquiaCloudApi\CloudApi
13
 */
14
class Servers extends CloudApiBase
15
{
16
    /**
17
     * Gets information about a single server.
18
     */
19
    public function get(string $environmentUuid, string $serverId): ServerResponse
20
    {
21
        return new ServerResponse(
22
            $this->client->request(
23
                'get',
24
                "/environments/$environmentUuid/servers/$serverId"
25
            )
26
        );
27
    }
28
29
    /**
30
     * Modifies configuration settings for a server.
31
     *
32
     * @param mixed[] $config
33
     */
34
    public function update(string $environmentUuid, string $serverId, array $config): OperationResponse
35
    {
36
        return new OperationResponse(
37
            $this->client->request(
38
                'put',
39
                "/environments/$environmentUuid/servers/$serverId",
40
                $config
41
            )
42
        );
43
    }
44
45
    /**
46
     * Show all servers associated with an environment.
47
     *
48
     * @return ServersResponse<ServerResponse>
49
     */
50
    public function getAll(string $environmentUuid): ServersResponse
51
    {
52
        return new ServersResponse(
53
            $this->client->request(
54
                'get',
55
                "/environments/$environmentUuid/servers"
56
            )
57
        );
58
    }
59
}
60