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

Notifications::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
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\Connector\ClientInterface;
6
use AcquiaCloudApi\Response\NotificationResponse;
7
use AcquiaCloudApi\Response\NotificationsResponse;
8
9
/**
10
 * Class Client
11
 * @package AcquiaCloudApi\CloudApi
12
 */
13
class Notifications implements CloudApi
14
{
15
16
    /** @var ClientInterface The API client. */
17
    protected $client;
18
19
    /**
20
     * Client constructor.
21
     *
22
     * @param ClientInterface $client
23
     */
24
    public function __construct(ClientInterface $client)
25
    {
26
        $this->client = $client;
27
    }
28
    /**
29
     * Returns details about a notification.
30
     *
31
     * @return NotificationResponse
32
     */
33
    public function get($notificationUuid)
34
    {
35
        return new NotificationResponse(
36
            $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

36
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
37
                'get',
38
                "/notifications/${notificationUuid}"
39
            )
40
        );
41
    }
42
43
    /**
44
     * Returns a list of notifications.
45
     *
46
     * @param string $applicationUuid
47
     *
48
     * @return NotificationsResponse
49
     */
50
    public function getAll($applicationUuid)
51
    {
52
        return new NotificationsResponse(
53
            $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

53
            /** @scrutinizer ignore-type */ $this->client->request(
Loading history...
54
                'get',
55
                "/applications/${applicationUuid}/notifications"
56
            )
57
        );
58
    }
59
}
60