Passed
Push — master ( 6b2979...464731 )
by Alex
04:00 queued 11s
created

ODataURL::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace POData\ObjectModel;
6
7
/**
8
 * Class ODataURL Represents top level link.
9
 */
10
class ODataURL
11
{
12
13
    /**
14
     * contains the url value.
15
     *
16
     * @var string
17
     */
18
    private $url;
19
20
    /**
21
     * ODataURL constructor.
22
     * @param string $url
23
     */
24
    public function __construct(string $url)
25
    {
26
        $this
27
            ->setUrl($url);
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getUrl(): string
34
    {
35
        return $this->url;
36
    }
37
38
    /**
39
     * @param  string   $url
40
     * @return ODataURL
41
     */
42
    public function setUrl(string $url): ODataURL
43
    {
44
        $this->url = $url;
45
        return $this;
46
    }
47
48
    /**
49
     * @param  string|null $msg
50
     * @return bool
51
     */
52
    public function isOk(&$msg = null): bool
53
    {
54
        if (null == $this->url || empty($this->url)) {
55
            $msg = 'Url value must be non-empty';
56
            return false;
57
        }
58
        return true;
59
    }
60
}
61