CalendarEventBuilder::build()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 10
cts 10
cp 1
rs 9.4285
cc 2
eloc 9
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Cp\Calendar\Builder;
4
5
use Cp\DomainObject\Week;
6
use Jsvrcek\ICS\Model\CalendarEvent;
7
8
/**
9
 * Class CalendarEventBuilder
10
 */
11
class CalendarEventBuilder
12
{
13
    /**
14
     * @param Week $week
15
     *
16
     * @return CalendarEvent[]
17
     */
18 1
    public function build(Week $week)
19
    {
20 1
        $events = [];
21 1
        foreach ($week->getTrainings() as $training) {
22 1
            $event = new CalendarEvent();
23 1
            $event->setUid(md5(uniqid()));
24 1
            $event->setSummary($training->getContent());
25 1
            $event->setDescription($training->getContent());
26 1
            $events[] = $event;
27 1
        }
28
29 1
        return $events;
30
    }
31
}
32