Passed
Pull Request — master (#22)
by Christopher
02:16
created

xsGMonth::fixValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace AlgoWeb\xsdTypes;
4
5
use AlgoWeb\xsdTypes\Facets\MinMaxTrait;
6
7
/**
8
 * The type xsd:gMonth represents a specific month that recurs every year. The letter g signifies "Gregorian."
9
 * xsd:gMonth can be used to indicate, for example, that fiscal year-end processing occurs in September of every year.
10
 * To represent a duration of months, use the duration type instead. The format of xsd:gMonth is --MM.
11
 *
12
 * An optional time zone expression may be added at the end of the value. The letter Z is used to indicate Coordinated
13
 * Universal Time (UTC). All other time zones are represented by their difference from Coordinated Universal Time in
14
 * the format +hh:mm, or -hh:mm. These values may range from -14:00 to 14:00. For example, US Eastern Standard Time,
15
 * which is five hours behind UTC, is represented as -05:00. If no time zone value is present, it is considered
16
 * unknown; it is not assumed to be UTC.
17
 * @package AlgoWeb\xsdTypes
18
 */
19 View Code Duplication
class xsGMonth extends xsAnySimpleType
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    use MinMaxTrait;
22
23
    /**
24
     * Construct.
25
     *
26
     * @param string $value
27
     */
28
    public function __construct($value)
29
    {
30
        parent::__construct($value);
31
        $this->setWhiteSpaceFacet('collapse');
32
    }
33
34
    public function fixValue()
35
    {
36
        parent::fixValue();
37
        $v = new \DateTime($this->value);
38
        //TODO: TechDebt, This needs to format to
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
39
        $this->value = $v->format(\DateTime::RFC3339);
40
    }
41
42
    protected function isOK()
43
    {
44
        $this->CheckMinMax(new \Date($this->value));
45
    }
46
}
47