Fix code before applying PHP CS Fixer

This commit is contained in:
Adrien Loison committed 2017-09-06 00:33:43 +02:00
1 parent 554ebf987b
commit 740fcfb8c1
21 files changed
+96 -79

No files matched your search

@@ -127,8 +127,8 @@ class CellValueFormatter
{
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
$nodeIntValue = intval($nodeValue);
// The "==" is intentionally not a "===" because only the value matters, not the type
$cellValue = ($nodeIntValue == $nodeValue) ? $nodeIntValue : floatval($nodeValue);
$nodeFloatValue = (float) $nodeValue;
$cellValue = ((float) $nodeIntValue === $nodeFloatValue) ? $nodeIntValue : $nodeFloatValue;
return $cellValue;
}
@@ -141,9 +141,7 @@ class CellValueFormatter
protected function formatBooleanCellValue($node)
{
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_BOOLEAN_VALUE);
// !! is similar to boolval()
$cellValue = !!$nodeValue;
return $cellValue;
return (bool) $nodeValue;
}
/**
@@ -162,16 +160,18 @@ class CellValueFormatter
if ($this->shouldFormatDates) {
// The date is already formatted in the "p" tag
$nodeWithValueAlreadyFormatted = $node->getElementsByTagName(self::XML_NODE_P)->item(0);
return $nodeWithValueAlreadyFormatted->nodeValue;
$cellValue = $nodeWithValueAlreadyFormatted->nodeValue;
} else {
// otherwise, get it from the "date-value" attribute
try {
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_DATE_VALUE);
return new \DateTime($nodeValue);
$cellValue = new \DateTime($nodeValue);
} catch (\Exception $e) {
return null;
$cellValue = null;
}
}
return $cellValue;
}
/**
@@ -190,16 +190,18 @@ class CellValueFormatter
if ($this->shouldFormatDates) {
// The date is already formatted in the "p" tag
$nodeWithValueAlreadyFormatted = $node->getElementsByTagName(self::XML_NODE_P)->item(0);
return $nodeWithValueAlreadyFormatted->nodeValue;
$cellValue = $nodeWithValueAlreadyFormatted->nodeValue;
} else {
// otherwise, get it from the "time-value" attribute
try {
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_TIME_VALUE);
return new \DateInterval($nodeValue);
$cellValue = new \DateInterval($nodeValue);
} catch (\Exception $e) {
return null;
$cellValue = null;
}
}
return $cellValue;
}
/**