diff --git a/Classes/PHPExcel.php b/Classes/PHPExcel.php index 188ed258..8f89c1bc 100644 --- a/Classes/PHPExcel.php +++ b/Classes/PHPExcel.php @@ -208,12 +208,9 @@ class PHPExcel */ public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null) { - if(is_null($iSheetIndex)) - { + if($iSheetIndex === NULL) { $this->_workSheetCollection[] = $pSheet; - } - else - { + } else { // Insert the sheet at the requested index array_splice( $this->_workSheetCollection, @@ -226,7 +223,6 @@ class PHPExcel if ($this->_activeSheetIndex >= $iSheetIndex) { ++$this->_activeSheetIndex; } - } return $pSheet; } @@ -417,7 +413,7 @@ class PHPExcel * @return PHPExcel_Worksheet */ public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) { - if (!is_null($this->getSheetByName($pSheet->getTitle()))) { + if ($this->getSheetByName($pSheet->getTitle()) !== NULL) { throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); } @@ -477,14 +473,14 @@ class PHPExcel public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { $returnValue = null; - if ($namedRange != '' && !is_null($namedRange)) { + if ($namedRange != '' && ($namedRange !== NULL)) { // first look for global defined name if (isset($this->_namedRanges[$namedRange])) { $returnValue = $this->_namedRanges[$namedRange]; } // then look for local defined name (has priority over global defined name if both names exist) - if (!is_null($pSheet) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { + if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { $returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]; } } @@ -500,7 +496,7 @@ class PHPExcel * @return PHPExcel */ public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) { - if (is_null($pSheet)) { + if ($pSheet === NULL) { if (isset($this->_namedRanges[$namedRange])) { unset($this->_namedRanges[$namedRange]); } diff --git a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php index 28353387..7a09ff77 100644 --- a/Classes/PHPExcel/CachedObjectStorage/CacheBase.php +++ b/Classes/PHPExcel/CachedObjectStorage/CacheBase.php @@ -221,7 +221,7 @@ class PHPExcel_CachedObjectStorage_CacheBase { */ public function copyCellCollection(PHPExcel_Worksheet $parent) { $this->_parent = $parent; - if ((!is_null($this->_currentObject)) && (is_object($this->_currentObject))) { + if (($this->_currentObject !== NULL) && (is_object($this->_currentObject))) { $this->_currentObject->attach($parent); } } // function copyCellCollection() diff --git a/Classes/PHPExcel/CachedObjectStorageFactory.php b/Classes/PHPExcel/CachedObjectStorageFactory.php index 12e60c5c..e29f5489 100644 --- a/Classes/PHPExcel/CachedObjectStorageFactory.php +++ b/Classes/PHPExcel/CachedObjectStorageFactory.php @@ -66,7 +66,7 @@ class PHPExcel_CachedObjectStorageFactory { public static function getCacheStorageMethod() { - if (!is_null(self::$_cacheStorageMethod)) { + if (self::$_cacheStorageMethod !== NULL) { return self::$_cacheStorageMethod; } return null; @@ -74,7 +74,7 @@ class PHPExcel_CachedObjectStorageFactory { public static function getCacheStorageClass() { - if (!is_null(self::$_cacheStorageClass)) { + if (self::$_cacheStorageClass !== NULL) { return self::$_cacheStorageClass; } return null; @@ -115,7 +115,7 @@ class PHPExcel_CachedObjectStorageFactory { } } - if (is_null(self::$_cacheStorageMethod)) { + if (self::$_cacheStorageMethod === NULL) { self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; self::$_cacheStorageMethod = $method; } @@ -125,13 +125,13 @@ class PHPExcel_CachedObjectStorageFactory { public static function getInstance(PHPExcel_Worksheet $parent) { $cacheMethodIsAvailable = TRUE; - if (is_null(self::$_cacheStorageMethod)) { + if (self::$_cacheStorageMethod === NULL) { $cacheMethodIsAvailable = self::initialize(); } if ($cacheMethodIsAvailable) { $instance = new self::$_cacheStorageClass($parent,self::$_storageMethodParameters[self::$_cacheStorageMethod]); - if (!is_null($instance)) { + if ($instance !== NULL) { return $instance; } } diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index 5c5cb1e7..8debb323 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -1710,7 +1710,7 @@ class PHPExcel_Calculation { * @return PHPExcel_Calculation */ public static function getInstance() { - if (!isset(self::$_instance) || is_null(self::$_instance)) { + if (!isset(self::$_instance) || (self::$_instance === NULL)) { self::$_instance = new PHPExcel_Calculation(); } @@ -1726,7 +1726,7 @@ class PHPExcel_Calculation { * @return null */ public static function flushInstance() { - if (isset(self::$_instance) && !is_null(self::$_instance)) { + if (isset(self::$_instance) && (self::$_instance !== NULL)) { self::$_instance->clearCalculationCache(); } } // function flushInstance() @@ -2000,7 +2000,7 @@ class PHPExcel_Calculation { private static $functionReplaceToLocale = null; public function _translateFormulaToLocale($formula) { - if (is_null(self::$functionReplaceFromExcel)) { + if (self::$functionReplaceFromExcel === NULL) { self::$functionReplaceFromExcel = array(); foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) { self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui'; @@ -2011,7 +2011,7 @@ class PHPExcel_Calculation { } - if (is_null(self::$functionReplaceToLocale)) { + if (self::$functionReplaceToLocale === NULL) { self::$functionReplaceToLocale = array(); foreach(array_values(self::$_localeFunctions) as $localeFunctionName) { self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2'; @@ -2029,7 +2029,7 @@ class PHPExcel_Calculation { private static $functionReplaceToExcel = null; public function _translateFormulaToEnglish($formula) { - if (is_null(self::$functionReplaceFromLocale)) { + if (self::$functionReplaceFromLocale === NULL) { self::$functionReplaceFromLocale = array(); foreach(array_values(self::$_localeFunctions) as $localeFunctionName) { self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui'; @@ -2039,7 +2039,7 @@ class PHPExcel_Calculation { } } - if (is_null(self::$functionReplaceToExcel)) { + if (self::$functionReplaceToExcel === NULL) { self::$functionReplaceToExcel = array(); foreach(array_keys(self::$_localeFunctions) as $excelFunctionName) { self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2'; diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index 81462cea..4bcca6ca 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -316,7 +316,7 @@ class PHPExcel_Cell */ public function setCalculatedValue($pValue = null) { - if (!is_null($pValue)) { + if ($pValue !== NULL) { $this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue; } diff --git a/Classes/PHPExcel/DocumentProperties.php b/Classes/PHPExcel/DocumentProperties.php index 2893fc0c..f55eedc4 100644 --- a/Classes/PHPExcel/DocumentProperties.php +++ b/Classes/PHPExcel/DocumentProperties.php @@ -196,7 +196,7 @@ class PHPExcel_DocumentProperties * @return PHPExcel_DocumentProperties */ public function setCreated($pValue = null) { - if (is_null($pValue)) { + if ($pValue === NULL) { $pValue = time(); } elseif (is_string($pValue)) { if (is_numeric($pValue)) { @@ -226,7 +226,7 @@ class PHPExcel_DocumentProperties * @return PHPExcel_DocumentProperties */ public function setModified($pValue = null) { - if (is_null($pValue)) { + if ($pValue === NULL) { $pValue = time(); } elseif (is_string($pValue)) { if (is_numeric($pValue)) { @@ -439,12 +439,12 @@ class PHPExcel_DocumentProperties * @return PHPExcel_DocumentProperties */ public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) { - if ((is_null($propertyType)) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER, + if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER, self::PROPERTY_TYPE_FLOAT, self::PROPERTY_TYPE_STRING, self::PROPERTY_TYPE_DATE, self::PROPERTY_TYPE_BOOLEAN)))) { - if (is_null($propertyValue)) { + if ($propertyValue === NULL) { $propertyType = self::PROPERTY_TYPE_STRING; } elseif (is_float($propertyValue)) { $propertyType = self::PROPERTY_TYPE_FLOAT; diff --git a/Classes/PHPExcel/IOFactory.php b/Classes/PHPExcel/IOFactory.php index 7f3c23f8..50ca0aca 100644 --- a/Classes/PHPExcel/IOFactory.php +++ b/Classes/PHPExcel/IOFactory.php @@ -139,7 +139,7 @@ class PHPExcel_IOFactory $classFile = str_replace('{0}', $writerType, $searchLocation['path']); $instance = new $className($phpExcel); - if (!is_null($instance)) { + if ($instance !== NULL) { return $instance; } } @@ -169,7 +169,7 @@ class PHPExcel_IOFactory $classFile = str_replace('{0}', $readerType, $searchLocation['path']); $instance = new $className(); - if (!is_null($instance)) { + if ($instance !== NULL) { return $instance; } } diff --git a/Classes/PHPExcel/NamedRange.php b/Classes/PHPExcel/NamedRange.php index 72e70983..5d4c25aa 100644 --- a/Classes/PHPExcel/NamedRange.php +++ b/Classes/PHPExcel/NamedRange.php @@ -82,7 +82,7 @@ class PHPExcel_NamedRange public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) { // Validate data - if (is_null($pName) || is_null($pWorksheet)|| is_null($pRange)) { + if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) { throw new Exception('Parameters can not be null.'); } @@ -111,17 +111,17 @@ class PHPExcel_NamedRange * @return PHPExcel_NamedRange */ public function setName($value = null) { - if (!is_null($value)) { + if ($value !== NULL) { // Old title $oldTitle = $this->_name; // Re-attach - if (!is_null($this->_worksheet)) { + if ($this->_worksheet !== NULL) { $this->_worksheet->getParent()->removeNamedRange($this->_name,$this->_worksheet); } $this->_name = $value; - if (!is_null($this->_worksheet)) { + if ($this->_worksheet !== NULL) { $this->_worksheet->getParent()->addNamedRange($this); } @@ -148,7 +148,7 @@ class PHPExcel_NamedRange * @return PHPExcel_NamedRange */ public function setWorksheet(PHPExcel_Worksheet $value = null) { - if (!is_null($value)) { + if ($value !== NULL) { $this->_worksheet = $value; } return $this; @@ -170,7 +170,7 @@ class PHPExcel_NamedRange * @return PHPExcel_NamedRange */ public function setRange($value = null) { - if (!is_null($value)) { + if ($value !== NULL) { $this->_range = $value; } return $this; diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index 0a17d157..05657721 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -500,7 +500,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader break; } // echo 'Data value is '.$dataValue.'
'; -// if (!is_null($hyperlink)) { +// if ($hyperlink !== NULL) { // echo 'Hyperlink is '.$hyperlink.'
'; // } } @@ -525,7 +525,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader // echo 'Adjusted Formula: '.$cellDataFormula.'
'; } - if (!is_null($type)) { + if ($type !== NULL) { $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type); if ($hasCalculatedValue) { // echo 'Forumla result is '.$dataValue.'
'; @@ -535,7 +535,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader ($cellDataOfficeAttributes['value-type'] == 'time')) { $objPHPExcel->getActiveSheet()->getStyle($columnID.$rowID)->getNumberFormat()->setFormatCode($formatting); } - if (!is_null($hyperlink)) { + if ($hyperlink !== NULL) { $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink); } } diff --git a/Classes/PHPExcel/RichText.php b/Classes/PHPExcel/RichText.php index 2391fcb3..77890269 100644 --- a/Classes/PHPExcel/RichText.php +++ b/Classes/PHPExcel/RichText.php @@ -54,7 +54,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable $this->_richTextElements = array(); // Rich-Text string attached to cell? - if (!is_null($pCell)) { + if ($pCell !== NULL) { // Add cell text and style if ($pCell->getValue() != "") { $objRun = new PHPExcel_RichText_Run($pCell->getValue()); diff --git a/Classes/PHPExcel/Shared/File.php b/Classes/PHPExcel/Shared/File.php index 24ba66a0..31d10552 100644 --- a/Classes/PHPExcel/Shared/File.php +++ b/Classes/PHPExcel/Shared/File.php @@ -80,7 +80,7 @@ class PHPExcel_Shared_File } // Found something? - if ($returnValue == '' || is_null($returnValue)) { + if ($returnValue == '' || ($returnValue === NULL)) { $pathArray = explode('/' , $pFilename); while(in_array('..', $pathArray) && $pathArray[0] != '..') { for ($i = 0; $i < count($pathArray); ++$i) { diff --git a/Classes/PHPExcel/Shared/OLE/PPS/Root.php b/Classes/PHPExcel/Shared/OLE/PPS/Root.php index 532e652f..2c1a4a40 100644 --- a/Classes/PHPExcel/Shared/OLE/PPS/Root.php +++ b/Classes/PHPExcel/Shared/OLE/PPS/Root.php @@ -79,7 +79,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS if (is_resource($filename)) { $this->_FILEH_ = $filename; } else if ($filename == '-' || $filename == '') { - if (is_null($this->_tmp_dir)) + if ($this->_tmp_dir === NULL) $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); $this->_FILEH_ = fopen($this->_tmp_filename,"w+b"); diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php index f4e0d69c..c2d45e90 100644 --- a/Classes/PHPExcel/Shared/OLERead.php +++ b/Classes/PHPExcel/Shared/OLERead.php @@ -175,7 +175,7 @@ class PHPExcel_Shared_OLERead { */ public function getStream($stream) { - if (is_null($stream)) { + if ($stream === NULL) { return null; } diff --git a/Classes/PHPExcel/Shared/XMLWriter.php b/Classes/PHPExcel/Shared/XMLWriter.php index c7dfeb56..2a8ddec5 100644 --- a/Classes/PHPExcel/Shared/XMLWriter.php +++ b/Classes/PHPExcel/Shared/XMLWriter.php @@ -65,7 +65,7 @@ class PHPExcel_Shared_XMLWriter extends XMLWriter { $this->openMemory(); } else { // Create temporary filename - if (is_null($pTemporaryStorageFolder)) + if ($pTemporaryStorageFolder === NULL) $pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir(); $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index c4c1e652..d805626c 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -1076,7 +1076,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) && (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) { $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this); - if (!is_null($namedRange)) { + if ($namedRange !== NULL) { $pCoordinate = $namedRange->getRange(); if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { if (!$namedRange->getLocalOnly()) { @@ -2278,7 +2278,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable */ public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this); - if (!is_null($namedRange)) { + if ($namedRange !== NULL) { $pWorkSheet = $namedRange->getWorksheet(); $pCellRange = $namedRange->getRange(); @@ -2551,7 +2551,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable */ public function getTabColor() { - if (is_null($this->_tabColor)) + if ($this->_tabColor === NULL) $this->_tabColor = new PHPExcel_Style_Color(); return $this->_tabColor; @@ -2577,7 +2577,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable */ public function isTabColorSet() { - return !is_null($this->_tabColor); + return ($this->_tabColor !== NULL); } /** diff --git a/Classes/PHPExcel/Writer/Excel2007/StringTable.php b/Classes/PHPExcel/Writer/Excel2007/StringTable.php index 8165df1f..3e429cda 100644 --- a/Classes/PHPExcel/Writer/Excel2007/StringTable.php +++ b/Classes/PHPExcel/Writer/Excel2007/StringTable.php @@ -45,7 +45,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr */ public function createStringTable($pSheet = null, $pExistingTable = null) { - if (!is_null($pSheet)) { + if ($pSheet !== NULL) { // Create string lookup table $aStringTable = array(); $cellCollection = null; @@ -64,14 +64,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr $cell = $pSheet->getCell($cellID); $cellValue = $cell->getValue(); if (!is_object($cellValue) && - !is_null($cellValue) && + ($cellValue !== NULL) && $cellValue !== '' && !isset($aFlippedStringTable[$cellValue]) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) { $aStringTable[] = $cellValue; $aFlippedStringTable[$cellValue] = true; } elseif ($cellValue instanceof PHPExcel_RichText && - !is_null($cellValue) && + ($cellValue !== NULL) && !isset($aFlippedStringTable[$cellValue->getHashCode()])) { $aStringTable[] = $cellValue; $aFlippedStringTable[$cellValue->getHashCode()] = true;