diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php
index f5d547e..16b7ac5 100644
--- a/Classes/PHPExcel/Calculation.php
+++ b/Classes/PHPExcel/Calculation.php
@@ -2317,11 +2317,9 @@ class PHPExcel_Calculation {
if ($resize == 2) {
// Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger
self::_resizeMatricesExtend($operand1,$operand2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
-// self::_resizeMatricesExtend($operand1,$operand2);
} elseif ($resize == 1) {
// Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller
self::_resizeMatricesShrink($operand1,$operand2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns);
-// self::_resizeMatricesShrink($operand1,$operand2);
}
} // function _checkMatrixOperands()
@@ -2355,10 +2353,6 @@ class PHPExcel_Calculation {
* @param mixed &$matrix2 Second matrix operand
*/
private static function _resizeMatricesShrink(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
-// private static function _resizeMatricesShrink(&$matrix1,&$matrix2) {
-// list($matrix1Rows,$matrix1Columns) = self::_getMatrixDimensions($matrix1);
-// list($matrix2Rows,$matrix2Columns) = self::_getMatrixDimensions($matrix2);
-
if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
if ($matrix2Columns < $matrix1Columns) {
for ($i = 0; $i < $matrix1Rows; ++$i) {
@@ -2398,10 +2392,6 @@ class PHPExcel_Calculation {
* @param mixed &$matrix2 Second matrix operand
*/
private static function _resizeMatricesExtend(&$matrix1,&$matrix2,$matrix1Rows,$matrix1Columns,$matrix2Rows,$matrix2Columns) {
-// private static function _resizeMatricesExtend(&$matrix1,&$matrix2) {
-// list($matrix1Rows,$matrix1Columns) = self::_getMatrixDimensions($matrix1);
-// list($matrix2Rows,$matrix2Columns) = self::_getMatrixDimensions($matrix2);
-
if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) {
if ($matrix2Columns < $matrix1Columns) {
for ($i = 0; $i < $matrix2Rows; ++$i) {
diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php
index 0fdccb1..835cc8e 100644
--- a/Classes/PHPExcel/Cell.php
+++ b/Classes/PHPExcel/Cell.php
@@ -140,7 +140,7 @@ class PHPExcel_Cell
$this->_parent = $pSheet;
// Set datatype?
- if (!is_null($pDataType)) {
+ if ($pDataType !== NULL) {
$this->_dataType = $pDataType;
} else {
if (!self::getValueBinder()->bindValue($this, $pValue)) {
@@ -280,10 +280,10 @@ class PHPExcel_Cell
return $result;
}
- if (is_null($this->_value)) {
+// if (is_null($this->_value)) {
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise
';
- return null;
- }
+// return null;
+// }
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'
';
return $this->_value;
}
diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php
index 610d28d..9a9464a 100644
--- a/Classes/PHPExcel/Writer/Excel2007.php
+++ b/Classes/PHPExcel/Writer/Excel2007.php
@@ -188,7 +188,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
*/
public function save($pFilename = null)
{
- if (!is_null($this->_spreadSheet)) {
+ if ($this->_spreadSheet !== NULL) {
// garbage collect
$this->_spreadSheet->garbageCollect();
@@ -243,7 +243,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet);
- if (!is_null($customPropertiesPart)) {
+ if ($customPropertiesPart !== NULL) {
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
}
@@ -363,7 +363,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
* @throws Exception
*/
public function getPHPExcel() {
- if (!is_null($this->_spreadSheet)) {
+ if ($this->_spreadSheet !== NULL) {
return $this->_spreadSheet;
} else {
throw new Exception("No PHPExcel assigned.");
@@ -503,7 +503,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
public function setUseDiskCaching($pValue = false, $pDirectory = null) {
$this->_useDiskCaching = $pValue;
- if (!is_null($pDirectory)) {
+ if ($pDirectory !== NULL) {
if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory;
} else {
diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php
index 6c74a3d..24b3d71 100644
--- a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php
+++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php
@@ -934,12 +934,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
*/
private function _writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null)
{
- $pCell = $pSheet->getCell($pCellAddress);
-
if (is_array($pStringTable) && is_array($pFlippedStringTable)) {
// Cell
+ $pCell = $pSheet->getCell($pCellAddress);
$objWriter->startElement('c');
- $objWriter->writeAttribute('r', $pCell->getCoordinate());
+ $objWriter->writeAttribute('r', $pCellAddress);
// Sheet styles
if ($pCell->getXfIndex() != '') {
@@ -947,18 +946,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
}
// If cell value is supplied, write cell value
- if (is_object($pCell->getValue()) || $pCell->getValue() !== '') {
+ $cellValue = $pCell->getValue();
+ if (is_object($cellValue) || $cellValue !== '') {
// Map type
$mappedType = $pCell->getDataType();
// Write data type depending on its type
switch (strtolower($mappedType)) {
case 'inlinestr': // Inline string
- $objWriter->writeAttribute('t', $mappedType);
- break;
case 's': // String
- $objWriter->writeAttribute('t', $mappedType);
- break;
case 'b': // Boolean
$objWriter->writeAttribute('t', $mappedType);
break;
@@ -967,7 +963,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if ($this->getParentWriter()->getPreCalculateFormulas()) {
$calculatedValue = $pCell->getCalculatedValue();
} else {
- $calculatedValue = $pCell->getValue();
+ $calculatedValue = $cellValue;
}
if (is_string($calculatedValue)) {
$objWriter->writeAttribute('t', 'str');
@@ -980,22 +976,22 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Write data depending on its type
switch (strtolower($mappedType)) {
case 'inlinestr': // Inline string
- if (! $pCell->getValue() instanceof PHPExcel_RichText) {
- $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($pCell->getValue()) ) );
- } else if ($pCell->getValue() instanceof PHPExcel_RichText) {
+ if (! $cellValue instanceof PHPExcel_RichText) {
+ $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) );
+ } else if ($cellValue instanceof PHPExcel_RichText) {
$objWriter->startElement('is');
- $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pCell->getValue());
+ $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
$objWriter->endElement();
}
break;
case 's': // String
- if (! $pCell->getValue() instanceof PHPExcel_RichText) {
- if (isset($pFlippedStringTable[$pCell->getValue()])) {
- $objWriter->writeElement('v', $pFlippedStringTable[$pCell->getValue()]);
+ if (! $cellValue instanceof PHPExcel_RichText) {
+ if (isset($pFlippedStringTable[$cellValue])) {
+ $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]);
}
- } else if ($pCell->getValue() instanceof PHPExcel_RichText) {
- $objWriter->writeElement('v', $pFlippedStringTable[$pCell->getValue()->getHashCode()]);
+ } else if ($cellValue instanceof PHPExcel_RichText) {
+ $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]);
}
break;
@@ -1004,20 +1000,19 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if($attributes['t'] == 'array') {
$objWriter->startElement('f');
$objWriter->writeAttribute('t', 'array');
- $objWriter->writeAttribute('ref', $pCell->getCoordinate());
+ $objWriter->writeAttribute('ref', $pCellAddress);
$objWriter->writeAttribute('aca', '1');
$objWriter->writeAttribute('ca', '1');
- $objWriter->text(substr($pCell->getValue(), 1));
+ $objWriter->text(substr($cellValue, 1));
$objWriter->endElement();
} else {
- $objWriter->writeElement('f', substr($pCell->getValue(), 1));
+ $objWriter->writeElement('f', substr($cellValue, 1));
}
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
if ($this->getParentWriter()->getPreCalculateFormulas()) {
$calculatedValue = $pCell->getCalculatedValue();
if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
- $v = PHPExcel_Shared_String::FormatNumber($calculatedValue);
- $objWriter->writeElement('v', $v);
+ $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue));
} else {
$objWriter->writeElement('v', '0');
}
@@ -1028,18 +1023,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
break;
case 'n': // Numeric
// force point as decimal separator in case current locale uses comma
- $v = str_replace(',', '.', $pCell->getValue());
- $objWriter->writeElement('v', $v);
+ $objWriter->writeElement('v', str_replace(',', '.', $cellValue));
break;
case 'b': // Boolean
- $objWriter->writeElement('v', ($pCell->getValue() ? '1' : '0'));
+ $objWriter->writeElement('v', ($cellValue ? '1' : '0'));
break;
case 'e': // Error
- if (substr($pCell->getValue(), 0, 1) == '=') {
- $objWriter->writeElement('f', substr($pCell->getValue(), 1));
- $objWriter->writeElement('v', substr($pCell->getValue(), 1));
+ if (substr($cellValue, 0, 1) == '=') {
+ $objWriter->writeElement('f', substr($cellValue, 1));
+ $objWriter->writeElement('v', substr($cellValue, 1));
} else {
- $objWriter->writeElement('v', $pCell->getValue());
+ $objWriter->writeElement('v', $cellValue);
}
break;