DateTimesProperty   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 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\Property;
13
14
use Eluceo\iCal\Property;
15
use Eluceo\iCal\Util\DateUtil;
16
17
class DateTimesProperty extends Property
18
{
19
    /**
20
     * @param string               $name
21
     * @param \DateTimeInterface[] $dateTimes
22
     * @param bool                 $noTime
23
     * @param bool                 $useTimezone
24
     * @param bool                 $useUtc
25
     * @param string               $timezoneString
26
     */
27 2
    public function __construct(
28
        $name,
29
        $dateTimes = [],
30
        $noTime = false,
31
        $useTimezone = false,
32
        $useUtc = false,
33
        $timezoneString = ''
34
    ) {
35 2
        $dates = [];
36 2
        $dateTime = new \DateTimeImmutable();
37 2
        foreach ($dateTimes as $dateTime) {
38 1
            $dates[] = DateUtil::getDateString($dateTime, $noTime, $useTimezone, $useUtc);
39
        }
40
41
        //@todo stop this triggering an E_NOTICE when $dateTimes is empty
42 2
        $params = DateUtil::getDefaultParams($dateTime, $noTime, $useTimezone, $timezoneString);
43
44 2
        parent::__construct($name, $dates, $params);
45 2
    }
46
}
47