ByebyeOptions::setUniqueServiceName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of the Ssdp project.
4
 *
5
 * @author Daniel Schröder <[email protected]>
6
 */
7
8
namespace GravityMedia\Ssdp\Options;
9
10
use GravityMedia\Ssdp\NotificationType;
11
use GravityMedia\Ssdp\UniqueServiceName;
12
13
/**
14
 * Byebye request options class
15
 *
16
 * @package GravityMedia\Ssdp\Request\Options
17
 */
18
class ByebyeOptions
19
{
20
    /**
21
     * Default notification type
22
     */
23
    const DEFAULT_NOTIFICATION_TYPE = 'upnp:rootdevice';
24
25
    /**
26
     * @var NotificationType
27
     */
28
    protected $notificationType;
29
30
    /**
31
     * @var UniqueServiceName
32
     */
33
    protected $uniqueServiceName;
34
35
    /**
36
     * Get notification type
37
     *
38
     * @return NotificationType
39
     */
40
    public function getNotificationType()
41
    {
42
        if (null === $this->notificationType) {
43
            return NotificationType::fromString(self::DEFAULT_NOTIFICATION_TYPE);
44
        }
45
46
        return $this->notificationType;
47
    }
48
49
    /**
50
     * Set notification type
51
     *
52
     * @param NotificationType $notificationType
53
     *
54
     * @return $this
55
     */
56
    public function setNotificationType(NotificationType $notificationType)
57
    {
58
        $this->notificationType = $notificationType;
59
        return $this;
60
    }
61
62
    /**
63
     * Get unique service name
64
     *
65
     * @return UniqueServiceName
66
     */
67
    public function getUniqueServiceName()
68
    {
69
        if (null === $this->uniqueServiceName) {
70
            return new UniqueServiceName();
71
        }
72
73
        return $this->uniqueServiceName;
74
    }
75
76
    /**
77
     * Set unique service name
78
     *
79
     * @param UniqueServiceName $uniqueServiceName
80
     *
81
     * @return $this
82
     */
83
    public function setUniqueServiceName(UniqueServiceName $uniqueServiceName)
84
    {
85
        $this->uniqueServiceName = $uniqueServiceName;
86
        return $this;
87
    }
88
}
89