Subscriptions   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 14
c 1
b 0
f 0
dl 0
loc 42
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 3 1
A rename() 0 14 1
A get() 0 6 1
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