Passed
Pull Request — master (#111)
by Adam
01:45
created

OperationResponse::getNotificationUuid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AcquiaCloudApi\Response;
4
5
class OperationResponse extends GenericResponse
6
{
7
8
    /**
9
     * @var string $message
10
     */
11
    public $message;
12
13
    /**
14
     * @var object|null $links
15
     */
16
    public $links;
17
18
    /**
19
     * @param object $operation
20
     */
21
    public function __construct($operation)
22
    {
23
        $this->message = $operation->message;
24
        if (isset($operation->_links)) {
25
            $this->links = $operation->_links;
26
        }
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getNotificationUuid()
33
    {
34
        $notification = parse_url($this->getLink('notification'), PHP_URL_PATH);
35
        $segments = explode('/', rtrim($notification));
36
37
        return end($segments);
38
    }
39
}
40