From de021710e1c0dae732e61ecb42a9ac60440f55ee Mon Sep 17 00:00:00 2001 From: "godzilla80@gmx.net" <> Date: Thu, 19 Mar 2009 21:20:47 +0000 Subject: replace is_null() function calls with native native language constuct --- .../Data/SqlMap/Configuration/TParameterMap.php | 8 ++--- framework/Data/SqlMap/Configuration/TResultMap.php | 8 ++--- .../Data/SqlMap/Configuration/TResultProperty.php | 8 ++--- .../SqlMap/Configuration/TSqlMapCacheModel.php | 8 ++--- .../Data/SqlMap/Configuration/TSqlMapStatement.php | 4 +-- .../Configuration/TSqlMapXmlConfiguration.php | 40 +++++++++++----------- 6 files changed, 38 insertions(+), 38 deletions(-) (limited to 'framework/Data/SqlMap/Configuration') diff --git a/framework/Data/SqlMap/Configuration/TParameterMap.php b/framework/Data/SqlMap/Configuration/TParameterMap.php index f4fbbe1c..4b5ee144 100644 --- a/framework/Data/SqlMap/Configuration/TParameterMap.php +++ b/framework/Data/SqlMap/Configuration/TParameterMap.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -140,12 +140,12 @@ class TParameterMap extends TComponent { $value = $this->getObjectValue($parameterValue,$property); - if(!is_null($handler=$this->createTypeHandler($property, $registry))) + if(($handler=$this->createTypeHandler($property, $registry))!==null) $value = $handler->getParameter($value); $value = $this->nullifyDefaultValue($property,$value); - if(!is_null($type = $property->getType())) + if(($type = $property->getType())!==null) $value = $registry->convertToType($type, $value); return $value; @@ -197,7 +197,7 @@ class TParameterMap extends TComponent */ protected function nullifyDefaultValue($property,$value) { - if(!is_null($nullValue = $property->getNullValue())) + if(($nullValue = $property->getNullValue())!==null) { if($nullValue === $value) $value = null; diff --git a/framework/Data/SqlMap/Configuration/TResultMap.php b/framework/Data/SqlMap/Configuration/TResultMap.php index d59d9522..e85dc1aa 100644 --- a/framework/Data/SqlMap/Configuration/TResultMap.php +++ b/framework/Data/SqlMap/Configuration/TResultMap.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -162,7 +162,7 @@ class TResultMap extends TComponent $handler = $registry->getTypeHandler($this->getClass()); try { - if(!is_null($handler)) + if($handler!==null) return $handler->createNewInstance(); else return $registry->createInstanceOf($this->getClass()); @@ -184,12 +184,12 @@ class TResultMap extends TComponent public function resolveSubMap($registry,$row) { $subMap = $this; - if(!is_null($disc = $this->getDiscriminator())) + if(($disc = $this->getDiscriminator())!==null) { $value = $disc->getMapping()->getPropertyValue($registry,$row); $subMap = $disc->getSubMap((string)$value); - if(is_null($subMap)) + if($subMap===null) $subMap = $this; else if($subMap !== $this) $subMap = $subMap->resolveSubMap($registry,$row); diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php index 8e20d5e4..7316ef0b 100644 --- a/framework/Data/SqlMap/Configuration/TResultProperty.php +++ b/framework/Data/SqlMap/Configuration/TResultProperty.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -242,7 +242,7 @@ class TResultProperty extends TComponent $value = $this->getTypedValue($registry,$row[$index]); else if(isset($row[$name])) $value = $this->getTypedValue($registry,$row[$name]); - if(is_null($value) && !is_null($this->getNullValue())) + if(($value===null) && ($this->getNullValue()!==null)) $value = $this->getTypedValue($registry,$this->getNullValue()); return $value; } @@ -302,7 +302,7 @@ class TResultProperty extends TComponent */ public function instanceOfListType($target) { - if(is_null($this->getType())) + if($this->getType()===null) return TPropertyAccess::get($target,$this->getProperty()) instanceof TList; return $this->getPropertyValueType() == self::LIST_TYPE; } @@ -315,7 +315,7 @@ class TResultProperty extends TComponent */ public function instanceOfArrayType($target) { - if(is_null($this->getType())) + if($this->getType()===null) { $prop = TPropertyAccess::get($target,$this->getProperty()); if(is_object($prop)) diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php index d7984dc4..5d19a3a3 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -79,7 +79,7 @@ class TSqlMapCacheModel extends TComponent */ public function initialize($cache=null) { - if(is_null($cache)) + if($cache===null) $this->_cache= Prado::createComponent($this->getImplementationClass()); else $this->_cache=$cache; @@ -127,7 +127,7 @@ class TSqlMapCacheModel extends TComponent //if flush ? $value = $this->_cache->get($key); $this->_requests++; - if(!is_null($value)) + if($value!==null) $this->_hits++; return $value; } @@ -141,7 +141,7 @@ class TSqlMapCacheModel extends TComponent if($key instanceof TSqlMapCacheKey) $key = $key->getHash(); - if(!is_null($value)) + if($value!==null) $this->_cache->set($key, $value); } diff --git a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php index 3afcc75f..7e1783a3 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php @@ -5,7 +5,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -275,7 +275,7 @@ class TSqlMapStatement extends TComponent protected function createInstanceOf($registry,$type,$row=null) { $handler = $registry->getTypeHandler($type); - if(!is_null($handler)) + if($handler!==null) return $handler->createNewInstance($row); else return $registry->createInstanceOf($type); diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php index f2d13966..ba8c3d0c 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php @@ -4,14 +4,14 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration */ Prado::using('System.Data.SqlMap.Configuration.TSqlMapStatement'); - + /** * TSqlMapXmlConfig class file. * @@ -255,7 +255,7 @@ class TSqlMapXmlConfiguration extends TSqlMapXmlConfigBuilder $resultMap, $this->_configFile, $entry->getID()); } } - if(!is_null($entry->getDiscriminator())) + if($entry->getDiscriminator()!==null) $entry->getDiscriminator()->initialize($this->_manager); } } @@ -309,16 +309,16 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder private $_FlushOnExecuteStatements=array(); - /** - * Regular expressions for escaping simple/inline parameter symbols - */ - const SIMPLE_MARK='$'; - const INLINE_SYMBOL='#'; - const ESCAPED_SIMPLE_MARK_REGEXP='/\$\$/'; - const ESCAPED_INLINE_SYMBOL_REGEXP='/\#\#/'; - const SIMPLE_PLACEHOLDER='`!!`'; - const INLINE_PLACEHOLDER='`!!!`'; - + /** + * Regular expressions for escaping simple/inline parameter symbols + */ + const SIMPLE_MARK='$'; + const INLINE_SYMBOL='#'; + const ESCAPED_SIMPLE_MARK_REGEXP='/\$\$/'; + const ESCAPED_INLINE_SYMBOL_REGEXP='/\#\#/'; + const SIMPLE_PLACEHOLDER='`!!`'; + const INLINE_PLACEHOLDER='`!!!`'; + /** * @param TSqlMapXmlConfiguration parent xml configuration. */ @@ -434,7 +434,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder foreach($node->xpath('subMap') as $subMapNode) { - if(is_null($discriminator)) + if($discriminator===null) throw new TSqlMapConfigurationException( 'sqlmap_undefined_discriminator', $node, $this->_configFile,$subMapNode); $subMap = new TSubMap; @@ -442,7 +442,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder $discriminator->addSubMap($subMap); } - if(!is_null($discriminator)) + if($discriminator!==null) $resultMap->setDiscriminator($discriminator); return $resultMap; @@ -542,7 +542,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder $scope['file'] = $this->_configFile; $scope['node'] = $node; - $sqlStatement=preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP,self::INLINE_PLACEHOLDER,$sqlStatement); + $sqlStatement=preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP,self::INLINE_PLACEHOLDER,$sqlStatement); if($statement->parameterMap() === null) { // Build a Parametermap with the inline parameters. @@ -559,7 +559,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } $sqlStatement = $sqlText['sql']; } - $sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement); + $sqlStatement=preg_replace('/'.self::INLINE_PLACEHOLDER.'/',self::INLINE_SYMBOL,$sqlStatement); $this->prepareSql($statement, $sqlStatement, $node); } @@ -574,7 +574,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder protected function prepareSql($statement,$sqlStatement, $node) { $simpleDynamic = new TSimpleDynamicParser; - $sqlStatement=preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP,self::SIMPLE_PLACEHOLDER,$sqlStatement); + $sqlStatement=preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP,self::SIMPLE_PLACEHOLDER,$sqlStatement); $dynamics = $simpleDynamic->parse($sqlStatement); if(count($dynamics['parameters']) > 0) { @@ -583,7 +583,7 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } else $sql = new TStaticSql(); - $sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement); + $sqlStatement=preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/',self::SIMPLE_MARK,$sqlStatement); $sql->buildPreparedStatement($statement, $sqlStatement); $statement->setSqlText($sql); } @@ -737,4 +737,4 @@ class TSqlMapXmlMappingConfiguration extends TSqlMapXmlConfigBuilder } } } - + -- cgit v1.2.3