Passed
Push — master ( 19faf5...3be4ae )
by Christopher
01:56
created

xsDayTimeDuration::fixValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 6
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace AlgoWeb\xsdTypes;
4
5
/**
6
 * The type xsd:dayTimeDuration represents a duration of time expressed as a number of days, hours, minutes, and
7
 * seconds. The format of xsd:dayTimeDuration is PnDTnHnMnS, where P is a literal value that starts the expression,
8
 * nD is the number of days followed by a literal D, T is a literal value that separates the date and time, nH is
9
 * the number of hours followed by a literal H, nM is the number of minutes followed by a literal M, and nS is the
10
 * number of seconds followed by a literal S. The following rules apply to xsd:dayTimeDuration values:
11
 * - Any of these numbers and corresponding designators may be absent if they are equal to 0, but at least one
12
 *   number and designator must appear.
13
 * - The numbers may be any unsigned integer, with the exception of the number of seconds, which may be an
14
 *   unsigned decimal number.
15
 * - I f a decimal point appears in the number of seconds, there must be at least one digit after the decimal point.
16
 * - A minus sign may appear before the P to specify a negative duration.
17
 * - If no time items (hour, minute, second) are present, the letter T must not appear.
18
 * @package AlgoWeb\xsdTypes
19
 */
20 View Code Duplication
class xsDayTimeDuration extends xsDuration
21
{
22
    public function fixValue()
23
    {
24
        parent::fixValue();
25
        $v = new \DateInterval($this->value);
26
        $this->value = $this->format($v, 'PnDTnHnMnS');
27
    }
28
}
29