xsGYearMonth::isOK()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace AlgoWeb\xsdTypes;
4
5
use AlgoWeb\xsdTypes\AxillaryClasses\CalenderFactory;
6
use AlgoWeb\xsdTypes\Facets\MinMaxTrait;
7
8
/**
9
 * The type xsd:gYearMonth represents a specific month of a specific year. The letter g signifies "Gregorian." The
10
 * format of xsd:gYearMonth is CCYY-MM. No left truncation is allowed on either part. To represents years later than
11
 * 9999, additional digits can be added to the left of the year value. To represent years before 0001,
12
 * a preceding minus sign ("-") is permitted.
13
 *
14
 * An optional time zone expression may be added at the end of the value. The letter Z is used to indicate Coordinated
15
 * Universal Time (UTC). All other time zones are represented by their difference from Coordinated Universal Time in
16
 * the format +hh:mm, or -hh:mm. These values may range from -14:00 to 14:00. For example, US Eastern Standard Time,
17
 * which is five hours behind UTC, is represented as -05:00. If no time zone value is present, it is considered
18
 * unknown; it is not assumed to be UTC.
19
 * @package AlgoWeb\xsdTypes
20
 */
21 View Code Duplication
class xsGYearMonth extends xsAnySimpleType
22
{
23
    use MinMaxTrait;
24
25
    /**
26
     * Construct.
27
     *
28
     * @param string $value
29
     */
30
    public function __construct($value)
31
    {
32
        parent::__construct($value);
33
        $this->setWhiteSpaceFacet('collapse');
34
    }
35
36
    public function fixValue()
37
    {
38
        parent::fixValue();
39
        $yearMonthObject = CalenderFactory::fromYearMonth($this->value);
0 ignored issues
show
Unused Code introduced by
$yearMonthObject is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
40
    }
41
42
    protected function isOK()
43
    {
44
        $this->CheckMinMax(CalenderFactory::fromYearMonth($this->value));
45
    }
46
}
47