Subscriptions::getAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Response\OperationResponse;
6
use AcquiaCloudApi\Response\SubscriptionResponse;
7
use AcquiaCloudApi\Response\SubscriptionsResponse;
8
9
class Subscriptions extends CloudApiBase
10
{
11
    /**
12
     * Shows all Subscriptions.
13
     *
14
     * @return SubscriptionsResponse<SubscriptionResponse>
15
     */
16
    public function getAll(): SubscriptionsResponse
17
    {
18
        return new SubscriptionsResponse($this->client->request('get', '/subscriptions'));
19
    }
20
21
    /**
22
     * Shows information about an subscription.
23
     */
24
    public function get(string $subscriptionUuid): SubscriptionResponse
25
    {
26
        return new SubscriptionResponse(
27
            $this->client->request(
28
                'get',
29
                "/subscriptions/$subscriptionUuid"
30
            )
31
        );
32
    }
33
34
    /**
35
     * Renames an subscription.
36
     */
37
    public function rename(string $subscriptionUuid, string $name): OperationResponse
38
    {
39
40
        $options = [
41
            'json' => [
42
                'name' => $name,
43
            ],
44
        ];
45
46
        return new OperationResponse(
47
            $this->client->request(
48
                'put',
49
                "/subscriptions/$subscriptionUuid",
50
                $options
51
            )
52
        );
53
    }
54
}
55