summaryrefslogtreecommitdiff
path: root/vendor/eluceo/ical/src/Eluceo/iCal/Component/Alarm.php
blob: 9e0f0c1b41338b5b84b7f3d79407d47b3d00ee4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php

/*
 * This file is part of the eluceo/iCal package.
 *
 * (c) Markus Poerschke <markus@eluceo.de>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Eluceo\iCal\Component;

use Eluceo\iCal\Component;
use Eluceo\iCal\PropertyBag;
use Eluceo\iCal\Property;

/**
 * Implementation of the VALARM component.
 */
class Alarm extends Component
{
    /**
     * Alarm ACTION property.
     *
     * According to RFC 5545: 3.8.6.1. Action
     *
     * @link http://tools.ietf.org/html/rfc5545#section-3.8.6.1
     */
    const ACTION_AUDIO   = 'AUDIO';
    const ACTION_DISPLAY = 'DISPLAY';
    const ACTION_EMAIL   = 'EMAIL';

    protected $action;
    protected $repeat;
    protected $duration;
    protected $description;
    protected $attendee;
    protected $trigger;

    public function getType()
    {
        return 'VALARM';
    }

    public function getAction()
    {
        return $this->action;
    }

    public function getRepeat()
    {
        return $this->repeat;
    }

    public function getDuration()
    {
        return $this->duration;
    }

    public function getDescription()
    {
        return $this->description;
    }

    public function getAttendee()
    {
        return $this->attendee;
    }

    public function getTrigger()
    {
        return $this->trigger;
    }

    public function setAction($action)
    {
        $this->action = $action;

        return $this;
    }

    public function setRepeat($repeat)
    {
        $this->repeat = $repeat;

        return $this;
    }

    public function setDuration($duration)
    {
        $this->duration = $duration;

        return $this;
    }

    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    public function setAttendee($attendee)
    {
        $this->attendee = $attendee;

        return $this;
    }

    public function setTrigger($trigger)
    {
        $this->trigger = $trigger;

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function buildPropertyBag()
    {
        $propertyBag = new PropertyBag();

        if (null != $this->trigger) {
            $propertyBag->set('TRIGGER', $this->trigger);
        }

        if (null != $this->action) {
            $propertyBag->set('ACTION', $this->action);
        }

        if (null != $this->repeat) {
            $propertyBag->set('REPEAT', $this->repeat);
        }

        if (null != $this->duration) {
            $propertyBag->set('DURATION', $this->duration);
        }

        if (null != $this->description) {
            $propertyBag->set('DESCRIPTION', $this->description);
        }

        if (null != $this->attendee) {
            $propertyBag->set('ATTENDEE', $this->attendee);
        }

        return $propertyBag;
    }
}