diff --git a/composer.json b/composer.json index 7ea10715..b0dcb0b7 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ ] }, "require": { - "php": "^7.0", + "php": "5.6|^7.0", "ext-ctype": "*", "ext-dom": "*", "ext-gd": "*", diff --git a/samples/Basic/31_Document_properties_write.php b/samples/Basic/31_Document_properties_write.php index dec3cc32..bdce86dd 100644 --- a/samples/Basic/31_Document_properties_write.php +++ b/samples/Basic/31_Document_properties_write.php @@ -56,7 +56,7 @@ foreach ($customProperties as $customProperty) { $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', $propertyValue); + $formattedValue = date('d-M-Y H:i:s', (int) $propertyValue); } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; } else { diff --git a/samples/Basic/31_Document_properties_write_xls.php b/samples/Basic/31_Document_properties_write_xls.php index d58c3182..f3a48f95 100644 --- a/samples/Basic/31_Document_properties_write_xls.php +++ b/samples/Basic/31_Document_properties_write_xls.php @@ -56,7 +56,7 @@ foreach ($customProperties as $customProperty) { $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', $propertyValue); + $formattedValue = date('d-M-Y H:i:s', (int) $propertyValue); } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; } else { diff --git a/samples/Basic/40_Duplicate_style.php b/samples/Basic/40_Duplicate_style.php index a2dc5f5f..0366703d 100644 --- a/samples/Basic/40_Duplicate_style.php +++ b/samples/Basic/40_Duplicate_style.php @@ -30,7 +30,7 @@ for ($col = 1; $col <= 50; ++$col) { } } $d = microtime(true) - $t; -$helper->log('Add data (end) . time: ' . round($d . 2) . ' s'); +$helper->log('Add data (end) . time: ' . round((string) ($d . 2)) . ' s'); // Save $helper->write($spreadsheet, __FILE__); diff --git a/src/PhpSpreadsheet/Reader/BaseReader.php b/src/PhpSpreadsheet/Reader/BaseReader.php index 5a932cc1..a81a5f65 100644 --- a/src/PhpSpreadsheet/Reader/BaseReader.php +++ b/src/PhpSpreadsheet/Reader/BaseReader.php @@ -60,27 +60,11 @@ abstract class BaseReader implements IReader $this->readFilter = new DefaultReadFilter(); } - /** - * Read data only? - * If this is true, then the Reader will only read data values for cells, it will not read any formatting information. - * If false (the default) it will read data and formatting. - * - * @return bool - */ public function getReadDataOnly() { return $this->readDataOnly; } - /** - * Set read data only - * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. - * Set to false (the default) to advise the Reader to read both data and formatting for cells. - * - * @param bool $pValue - * - * @return IReader - */ public function setReadDataOnly($pValue) { $this->readDataOnly = (bool) $pValue; @@ -88,27 +72,11 @@ abstract class BaseReader implements IReader return $this; } - /** - * Read empty cells? - * If this is true (the default), then the Reader will read data values for all cells, irrespective of value. - * If false it will not read data for cells containing a null value or an empty string. - * - * @return bool - */ public function getReadEmptyCells() { return $this->readEmptyCells; } - /** - * Set read empty cells - * Set to true (the default) to advise the Reader read data values for all cells, irrespective of value. - * Set to false to advise the Reader to ignore cells containing a null value or an empty string. - * - * @param bool $pValue - * - * @return IReader - */ public function setReadEmptyCells($pValue) { $this->readEmptyCells = (bool) $pValue; @@ -116,29 +84,11 @@ abstract class BaseReader implements IReader return $this; } - /** - * Read charts in workbook? - * If this is true, then the Reader will include any charts that exist in the workbook. - * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. - * If false (the default) it will ignore any charts defined in the workbook file. - * - * @return bool - */ public function getIncludeCharts() { return $this->includeCharts; } - /** - * Set read charts in workbook - * Set to true, to advise the Reader to include any charts that exist in the workbook. - * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. - * Set to false (the default) to discard charts. - * - * @param bool $pValue - * - * @return IReader - */ public function setIncludeCharts($pValue) { $this->includeCharts = (bool) $pValue; @@ -146,27 +96,11 @@ abstract class BaseReader implements IReader return $this; } - /** - * Get which sheets to load - * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null - * indicating that all worksheets in the workbook should be loaded. - * - * @return mixed - */ public function getLoadSheetsOnly() { return $this->loadSheetsOnly; } - /** - * Set which sheets to load. - * - * @param mixed $value - * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. - * If NULL, then it tells the Reader to read all worksheets in the workbook - * - * @return IReader - */ public function setLoadSheetsOnly($value) { if ($value === null) { @@ -178,12 +112,6 @@ abstract class BaseReader implements IReader return $this; } - /** - * Set all sheets to load - * Tells the Reader to load all worksheets from the workbook. - * - * @return IReader - */ public function setLoadAllSheets() { $this->loadSheetsOnly = null; @@ -191,23 +119,11 @@ abstract class BaseReader implements IReader return $this; } - /** - * Read filter. - * - * @return IReadFilter - */ public function getReadFilter() { return $this->readFilter; } - /** - * Set read filter. - * - * @param IReadFilter $pValue - * - * @return IReader - */ public function setReadFilter(IReadFilter $pValue) { $this->readFilter = $pValue; diff --git a/src/PhpSpreadsheet/Reader/IReader.php b/src/PhpSpreadsheet/Reader/IReader.php index e35c4ee6..70a7a200 100644 --- a/src/PhpSpreadsheet/Reader/IReader.php +++ b/src/PhpSpreadsheet/Reader/IReader.php @@ -18,6 +18,112 @@ interface IReader */ public function canRead($pFilename); + /** + * Read data only? + * If this is true, then the Reader will only read data values for cells, it will not read any formatting information. + * If false (the default) it will read data and formatting. + * + * @return bool + */ + public function getReadDataOnly(); + + /** + * Set read data only + * Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information. + * Set to false (the default) to advise the Reader to read both data and formatting for cells. + * + * @param bool $pValue + * + * @return IReader + */ + public function setReadDataOnly($pValue); + + /** + * Read empty cells? + * If this is true (the default), then the Reader will read data values for all cells, irrespective of value. + * If false it will not read data for cells containing a null value or an empty string. + * + * @return bool + */ + public function getReadEmptyCells(); + + /** + * Set read empty cells + * Set to true (the default) to advise the Reader read data values for all cells, irrespective of value. + * Set to false to advise the Reader to ignore cells containing a null value or an empty string. + * + * @param bool $pValue + * + * @return IReader + */ + public function setReadEmptyCells($pValue); + + /** + * Read charts in workbook? + * If this is true, then the Reader will include any charts that exist in the workbook. + * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. + * If false (the default) it will ignore any charts defined in the workbook file. + * + * @return bool + */ + public function getIncludeCharts(); + + /** + * Set read charts in workbook + * Set to true, to advise the Reader to include any charts that exist in the workbook. + * Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value. + * Set to false (the default) to discard charts. + * + * @param bool $pValue + * + * @return IReader + */ + public function setIncludeCharts($pValue); + + /** + * Get which sheets to load + * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null + * indicating that all worksheets in the workbook should be loaded. + * + * @return mixed + */ + public function getLoadSheetsOnly(); + + /** + * Set which sheets to load. + * + * @param mixed $value + * This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name. + * If NULL, then it tells the Reader to read all worksheets in the workbook + * + * @return IReader + */ + public function setLoadSheetsOnly($value); + + /** + * Set all sheets to load + * Tells the Reader to load all worksheets from the workbook. + * + * @return IReader + */ + public function setLoadAllSheets(); + + /** + * Read filter. + * + * @return IReadFilter + */ + public function getReadFilter(); + + /** + * Set read filter. + * + * @param IReadFilter $pValue + * + * @return IReader + */ + public function setReadFilter(IReadFilter $pValue); + /** * Loads PhpSpreadsheet from file. *