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

Attendees::toLines()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 2 Features 1
Metric Value
c 3
b 2
f 1
dl 0
loc 9
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
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\Property\Event;
13
14
use Eluceo\iCal\Property;
15
16
class Attendees extends Property
17
{
18
    /** @var Property[] */
19
    protected $attendees = [];
20
21
    const PROPERTY_NAME = 'ATTENDEES';
22
23
    public function __construct()
24
    {
25
        // Overwrites constructor functionality of Property
26
    }
27
28
    /**
29
     * @param       $value
30
     * @param array $params
31
     *
32
     * @return $this
33
     */
34
    public function add($value, $params = [])
35
    {
36
        $this->attendees[] = new Property('ATTENDEE', $value, $params);
37
38
        return $this;
39
    }
40
41
    /**
42
     * @param Property[] $value
43
     *
44
     * @return $this
45
     */
46
    public function setValue($value)
47
    {
48
        $this->attendees = $value;
49
50
        return $this;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function toLines()
57
    {
58
        $lines = [];
59
        foreach ($this->attendees as $attendee) {
60
            $lines[] = $attendee->toLine();
61
        }
62
63
        return $lines;
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function getName()
70
    {
71
        return self::PROPERTY_NAME;
72
    }
73
}
74