Completed
Push — 1.x ( c7de71...29da9d )
by Markus
03:01
created

Alarm::getDuration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the eluceo/iCal package.
5
 *
6
 * (c) Markus Poerschke <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Eluceo\iCal\Component;
13
14
use Eluceo\iCal\Component;
15
use Eluceo\iCal\PropertyBag;
16
use Eluceo\iCal\Property;
17
18
/**
19
 * Implementation of the VALARM component.
20
 */
21
class Alarm extends Component
22
{
23
    /**
24
     * Alarm ACTION property.
25
     *
26
     * According to RFC 5545: 3.8.6.1. Action
27
     *
28
     * @link http://tools.ietf.org/html/rfc5545#section-3.8.6.1
29
     */
30
    const ACTION_AUDIO   = 'AUDIO';
31
    const ACTION_DISPLAY = 'DISPLAY';
32
    const ACTION_EMAIL   = 'EMAIL';
33
34
    protected $action;
35
    protected $repeat;
36
    protected $duration;
37
    protected $description;
38
    protected $attendee;
39
    protected $trigger;
40
41 1
    public function getType()
42
    {
43 1
        return 'VALARM';
44
    }
45
46
    public function getAction()
47
    {
48
        return $this->action;
49
    }
50
51
    public function getRepeat()
52
    {
53
        return $this->repeat;
54
    }
55
56
    public function getDuration()
57
    {
58
        return $this->duration;
59
    }
60
61
    public function getDescription()
62
    {
63
        return $this->description;
64
    }
65
66
    public function getAttendee()
67
    {
68
        return $this->attendee;
69
    }
70
71
    public function getTrigger()
72
    {
73
        return $this->trigger;
74
    }
75
76 1
    public function setAction($action)
77
    {
78 1
        $this->action = $action;
79
80 1
        return $this;
81
    }
82
83
    public function setRepeat($repeat)
84
    {
85
        $this->repeat = $repeat;
86
87
        return $this;
88
    }
89
90
    public function setDuration($duration)
91
    {
92
        $this->duration = $duration;
93
94
        return $this;
95
    }
96
97 1
    public function setDescription($description)
98
    {
99 1
        $this->description = $description;
100
101 1
        return $this;
102
    }
103
104
    public function setAttendee($attendee)
105
    {
106
        $this->attendee = $attendee;
107
108
        return $this;
109
    }
110
111 1
    public function setTrigger($trigger)
112
    {
113 1
        $this->trigger = $trigger;
114
115 1
        return $this;
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121 1
    public function buildPropertyBag()
122
    {
123 1
        $propertyBag = new PropertyBag();
124
125 1
        if (null != $this->trigger) {
126 1
            $propertyBag->set('TRIGGER', $this->trigger);
0 ignored issues
show
Deprecated Code introduced by
The method Eluceo\iCal\PropertyBag::set() has been deprecated with message: The property bag should not be used as a property factory. Use `$this->add` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
127
        }
128
129 1
        if (null != $this->action) {
130 1
            $propertyBag->set('ACTION', $this->action);
0 ignored issues
show
Deprecated Code introduced by
The method Eluceo\iCal\PropertyBag::set() has been deprecated with message: The property bag should not be used as a property factory. Use `$this->add` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
131
        }
132
133 1
        if (null != $this->repeat) {
134
            $propertyBag->set('REPEAT', $this->repeat);
0 ignored issues
show
Deprecated Code introduced by
The method Eluceo\iCal\PropertyBag::set() has been deprecated with message: The property bag should not be used as a property factory. Use `$this->add` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
135
        }
136
137 1
        if (null != $this->duration) {
138
            $propertyBag->set('DURATION', $this->duration);
0 ignored issues
show
Deprecated Code introduced by
The method Eluceo\iCal\PropertyBag::set() has been deprecated with message: The property bag should not be used as a property factory. Use `$this->add` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
139
        }
140
141 1
        if (null != $this->description) {
142 1
            $propertyBag->set('DESCRIPTION', $this->description);
0 ignored issues
show
Deprecated Code introduced by
The method Eluceo\iCal\PropertyBag::set() has been deprecated with message: The property bag should not be used as a property factory. Use `$this->add` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
143
        }
144
145 1
        if (null != $this->attendee) {
146
            $propertyBag->set('ATTENDEE', $this->attendee);
0 ignored issues
show
Deprecated Code introduced by
The method Eluceo\iCal\PropertyBag::set() has been deprecated with message: The property bag should not be used as a property factory. Use `$this->add` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
147
        }
148
149 1
        return $propertyBag;
150
    }
151
}
152