for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AlgoWeb\xsdTypes;
use AlgoWeb\xsdTypes\AxillaryClasses\CalenderFactory;
use AlgoWeb\xsdTypes\Facets\MinMaxTrait;
/**
* The type xsd:gYearMonth represents a specific month of a specific year. The letter g signifies "Gregorian." The
* format of xsd:gYearMonth is CCYY-MM. No left truncation is allowed on either part. To represents years later than
* 9999, additional digits can be added to the left of the year value. To represent years before 0001,
* a preceding minus sign ("-") is permitted.
*
* An optional time zone expression may be added at the end of the value. The letter Z is used to indicate Coordinated
* Universal Time (UTC). All other time zones are represented by their difference from Coordinated Universal Time in
* the format +hh:mm, or -hh:mm. These values may range from -14:00 to 14:00. For example, US Eastern Standard Time,
* which is five hours behind UTC, is represented as -05:00. If no time zone value is present, it is considered
* unknown; it is not assumed to be UTC.
* @package AlgoWeb\xsdTypes
*/
class xsGYearMonth extends xsAnySimpleType
{
use MinMaxTrait;
* Construct.
* @param string $value
public function __construct($value)
parent::__construct($value);
$this->setWhiteSpaceFacet('collapse');
}
public function fixValue()
parent::fixValue();
$yearMonthObject = CalenderFactory::fromYearMonth($this->value);
$yearMonthObject
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.
$myVar
$higher
protected function isOK()
$this->CheckMinMax(CalenderFactory::fromYearMonth($this->value));
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
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.