CalendarEventBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 13 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