Completed
Pull Request — master (#34)
by Adam
09:18
created

Notifications   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 31
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 6 1
A get() 0 6 1
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Connector\ClientInterface;
6
use AcquiaCloudApi\Response\NotificationResponse;
7
use AcquiaCloudApi\Response\NotificationsResponse;
8
9
/**
10
 * Class Notifications
11
 * @package AcquiaCloudApi\CloudApi
12
 */
13
class Notifications extends CloudApiBase implements CloudApiInterface
14
{
15
16
    /**
17
     * Returns details about a notification.
18
     *
19
     * @return NotificationResponse
20
     */
21
    public function get($notificationUuid)
22
    {
23
        return new NotificationResponse(
24
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...ns/'.$notificationUuid) can also be of type array; however, parameter $notification 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

24
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
25
                'get',
26
                "/notifications/${notificationUuid}"
27
            )
28
        );
29
    }
30
31
    /**
32
     * Returns a list of notifications.
33
     *
34
     * @param string $applicationUuid
35
     *
36
     * @return NotificationsResponse
37
     */
38
    public function getAll($applicationUuid)
39
    {
40
        return new NotificationsResponse(
41
            $this->client->request(
0 ignored issues
show
Bug introduced by
It seems like $this->client->request('...nUuid.'/notifications') can also be of type object; however, parameter $notifications 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

41
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
42
                'get',
43
                "/applications/${applicationUuid}/notifications"
44
            )
45
        );
46
    }
47
}
48