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

xsYearMonthDuration::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:yearMonthDuration represents a duration of time expressed as a number of years and months. The format
7
 * of xsd:yearMonthDuration is PnYnM, where P is a literal value that starts the expression, nY is the number of years
8
 * followed by a literal Y, nM is the number of months followed by a literal M. The following rules apply to
9
 * xsd:yearMonthDuration values:.
10
 *
11
 * - Either of these numbers and corresponding designators may be absent if they are equal to 0, but at least
12
 *   one number and designator must appear.
13
 * - The numbers may be any unsigned integer.
14
 * - A minus sign may appear before the P to specify a negative duration.
15
 * Note that this type was added to the XML Schema namespace as a result of XPath 2.0. It was not in the original XML
16
 * Schema 1.0 specification and is therefore not supported for use in XML Schema 1.0 schemas.
17
 * @package AlgoWeb\xsdTypes
18
 */
19 View Code Duplication
class xsYearMonthDuration extends xsDuration
20
{
21
    public function fixValue()
22
    {
23
        parent::fixValue();
24
        $v = new \DateInterval($this->value);
25
        $this->value = $this->format($v, 'PnYnM');
26
    }
27
}
28