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

OperationResponse::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 5
rs 10
c 1
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