mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-20 02:50:39 +00:00
PSR2 Fixes
This commit is contained in:
@@ -54,11 +54,11 @@ class testDataFileIterator implements Iterator
|
||||
} while (($testDataRow > '') && ($testDataRow{0} === '#'));
|
||||
|
||||
// Discard any comments at the end of the line
|
||||
list($testData) = explode('//',$testDataRow);
|
||||
list($testData) = explode('//', $testDataRow);
|
||||
|
||||
// Split data into an array of individual values and a result
|
||||
$dataSet = $this->_getcsv($testData, ',', "'");
|
||||
foreach($dataSet as &$dataValue) {
|
||||
foreach ($dataSet as &$dataValue) {
|
||||
$dataValue = $this->_parseDataValue($dataValue);
|
||||
}
|
||||
unset($dataValue);
|
||||
@@ -85,23 +85,24 @@ class testDataFileIterator implements Iterator
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function _parseDataValue($dataValue) {
|
||||
private function _parseDataValue($dataValue)
|
||||
{
|
||||
// discard any white space
|
||||
$dataValue = trim($dataValue);
|
||||
// test for the required datatype and convert accordingly
|
||||
if (!is_numeric($dataValue)) {
|
||||
if($dataValue == '') {
|
||||
$dataValue = NULL;
|
||||
$dataValue = null;
|
||||
} elseif($dataValue == '""') {
|
||||
$dataValue = '';
|
||||
} elseif(($dataValue[0] == '"') && ($dataValue[strlen($dataValue)-1] == '"')) {
|
||||
$dataValue = substr($dataValue,1,-1);
|
||||
} elseif(($dataValue[0] == '{') && ($dataValue[strlen($dataValue)-1] == '}')) {
|
||||
$dataValue = explode(';',substr($dataValue,1,-1));
|
||||
foreach($dataValue as &$dataRow) {
|
||||
if (strpos($dataRow,'|') !== FALSE) {
|
||||
foreach ($dataValue as &$dataRow) {
|
||||
if (strpos($dataRow,'|') !== false) {
|
||||
$dataRow = explode('|',$dataRow);
|
||||
foreach($dataRow as &$dataCell) {
|
||||
foreach ($dataRow as &$dataCell) {
|
||||
$dataCell = $this->_parseDataValue($dataCell);
|
||||
}
|
||||
unset($dataCell);
|
||||
@@ -112,20 +113,25 @@ class testDataFileIterator implements Iterator
|
||||
unset($dataRow);
|
||||
} else {
|
||||
switch (strtoupper($dataValue)) {
|
||||
case 'NULL' : $dataValue = NULL; break;
|
||||
case 'TRUE' : $dataValue = TRUE; break;
|
||||
case 'FALSE' : $dataValue = FALSE; break;
|
||||
case 'NULL':
|
||||
$dataValue = null;
|
||||
break;
|
||||
case 'TRUE':
|
||||
$dataValue = true;
|
||||
break;
|
||||
case 'FALSE':
|
||||
$dataValue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strpos($dataValue,'.') !== FALSE) {
|
||||
if (strpos($dataValue,'.') !== false) {
|
||||
$dataValue = (float) $dataValue;
|
||||
} else {
|
||||
$dataValue = (int) $dataValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $dataValue;
|
||||
return $dataValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user