Skip to content

Loading…

else if => elseif #1520

Merged
merged 1 commit into from

6 participants

@creocoder

How about make code consistent?

If not, maybe then make PR where elseif => else if?

Also i think its good idea to add rule about elseif or else if in Code Style Guide.

@samdark
Yii Software LLC member

I think it's better to use else if.

@mdomba
Yii Software LLC member

same here :)

@cebe
Yii Software LLC member

Have no preference here. Does it matter in any way?

@creocoder

I also have no preference, but only elseif works in <?php elseif: ?>, and elseif 1 byte less :)

@samdark
Yii Software LLC member

Not really but it's better to be consistent :)

@creocoder

Ok, ill make new PR with elseif => else if for files where it used, exclude vendors and views.

@Ragazzo

Hm, i think maybe it's good to mention that code-blocks breaks must be started each from new line? I, mean there are some examples in guide here in wiki, they are like

{
//code here
}

but nowhere in wiki is mentioned that breacks must be from new line, think its important, because some people use style like

if(){
}

this is not Yii way as i know, am i right?

@creocoder

This PR about else if => elseif problem and only in core. Yii does not enforce any coding style in end applications.

@samdark
Yii Software LLC member

@creocoder why elseif and not else if?

@samdark
Yii Software LLC member

Actually there are two pros when using elseif:

  1. It works a bit faster.
  2. It works like that
if($x):
  echo '1';
elseif:
  echo '2';
endif;

while else if doesn't. Important for views. I'm for elseif now :)

@samdark samdark was assigned
@samdark samdark merged commit 99e90d8 into yiisoft:master
@qiangxue
Yii Software LLC member

elseif is better which is being used in yii2 codebase.

However, in future I think we should avoid such massive commits unless very necessary.

@samdark
Yii Software LLC member

What's the issue with it? It's just search-replace + I've checked diff.

@qiangxue
Yii Software LLC member

We were using else if consistently previously. Even though elseif is better, the advantage over else if (which we were using consistently) is very marginal. By doing such massive commits, we may bring trouble to ourselves. Now every file has one additional commit history. If there are any outstanding branches, future merge may cause conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 3, 2012
  1. @creocoder

    else if => elseif

    creocoder committed
Showing with 394 additions and 394 deletions.
  1. +6 −6 framework/YiiBase.php
  2. +1 −1 framework/base/CApplication.php
  3. +14 −14 framework/base/CComponent.php
  4. +7 −7 framework/base/CErrorHandler.php
  5. +1 −1 framework/base/CModel.php
  6. +2 −2 framework/base/CModule.php
  7. +2 −2 framework/base/CStatePersister.php
  8. +2 −2 framework/caching/CDbCache.php
  9. +2 −2 framework/caching/CFileCache.php
  10. +1 −1 framework/cli/commands/MigrateCommand.php
  11. +3 −3 framework/cli/commands/shell/CrudCommand.php
  12. +4 −4 framework/cli/commands/shell/ModelCommand.php
  13. +1 −1 framework/cli/views/webapp/protected/components/UserIdentity.php
  14. +4 −4 framework/collections/CList.php
  15. +3 −3 framework/collections/CMap.php
  16. +1 −1 framework/collections/CQueue.php
  17. +1 −1 framework/collections/CStack.php
  18. +6 −6 framework/console/CConsoleCommand.php
  19. +1 −1 framework/console/CConsoleCommandRunner.php
  20. +6 −6 framework/db/CDbCommand.php
  21. +1 −1 framework/db/CDbConnection.php
  22. +16 −16 framework/db/ar/CActiveFinder.php
  23. +28 −28 framework/db/ar/CActiveRecord.php
  24. +2 −2 framework/db/schema/CDbColumnSchema.php
  25. +5 −5 framework/db/schema/CDbCommandBuilder.php
  26. +12 −12 framework/db/schema/CDbCriteria.php
  27. +1 −1 framework/db/schema/CDbSchema.php
  28. +2 −2 framework/db/schema/mssql/CMssqlColumnSchema.php
  29. +2 −2 framework/db/schema/mssql/CMssqlCommandBuilder.php
  30. +3 −3 framework/db/schema/mysql/CMysqlColumnSchema.php
  31. +1 −1 framework/db/schema/mysql/CMysqlSchema.php
  32. +1 −1 framework/db/schema/oci/COciSchema.php
  33. +7 −7 framework/db/schema/pgsql/CPgsqlColumnSchema.php
  34. +3 −3 framework/db/schema/pgsql/CPgsqlSchema.php
  35. +1 −1 framework/db/schema/sqlite/CSqliteSchema.php
  36. +1 −1 framework/gii/CCodeFile.php
  37. +1 −1 framework/gii/CCodeGenerator.php
  38. +3 −3 framework/gii/CCodeModel.php
  39. +1 −1 framework/gii/components/UserIdentity.php
  40. +4 −4 framework/gii/generators/crud/CrudCode.php
  41. +1 −1 framework/gii/generators/form/FormCode.php
  42. +5 −5 framework/gii/generators/model/ModelCode.php
  43. +1 −1 framework/gii/generators/module/ModuleCode.php
  44. +1 −1 framework/gii/views/common/code.php
  45. +1 −1 framework/i18n/CChoiceFormat.php
  46. +11 −11 framework/i18n/CDateFormatter.php
  47. +3 −3 framework/i18n/CLocale.php
  48. +1 −1 framework/i18n/CMessageSource.php
  49. +2 −2 framework/i18n/CNumberFormatter.php
  50. +1 −1 framework/i18n/gettext/CGettextMoFile.php
  51. +1 −1 framework/logging/CDbLogRoute.php
  52. +13 −13 framework/logging/CLogger.php
  53. +3 −3 framework/logging/CProfileLogRoute.php
  54. +1 −1 framework/logging/CWebLogRoute.php
  55. +1 −1 framework/test/CDbFixtureManager.php
  56. +1 −1 framework/utils/CDateTimeParser.php
  57. +4 −4 framework/utils/CFileHelper.php
  58. +3 −3 framework/utils/CTimestamp.php
  59. +2 −2 framework/utils/CVarDumper.php
  60. +6 −6 framework/validators/CFileValidator.php
  61. +1 −1 framework/validators/CRangeValidator.php
  62. +1 −1 framework/validators/CRequiredValidator.php
  63. +5 −5 framework/validators/CTypeValidator.php
  64. +1 −1 framework/views/ar/exception.php
  65. +1 −1 framework/views/ar/log-firebug.php
  66. +1 −1 framework/views/bg/log-firebug.php
  67. +1 −1 framework/views/de/log-firebug.php
  68. +1 −1 framework/views/el/log-firebug.php
  69. +1 −1 framework/views/es/log-firebug.php
  70. +1 −1 framework/views/exception.php
  71. +1 −1 framework/views/fr/log-firebug.php
  72. +1 −1 framework/views/he/log-firebug.php
  73. +1 −1 framework/views/hr/log-firebug.php
  74. +1 −1 framework/views/id/log-firebug.php
  75. +1 −1 framework/views/it/log-firebug.php
  76. +1 −1 framework/views/ja/log-firebug.php
  77. +1 −1 framework/views/ko/exception.php
  78. +1 −1 framework/views/ko/log-firebug.php
  79. +1 −1 framework/views/log-firebug.php
  80. +1 −1 framework/views/lt/exception.php
  81. +1 −1 framework/views/lt/log-firebug.php
  82. +1 −1 framework/views/lv/log-firebug.php
  83. +2 −2 framework/views/nl/log-firebug.php
  84. +1 −1 framework/views/no/log-firebug.php
  85. +1 −1 framework/views/pl/log-firebug.php
  86. +1 −1 framework/views/pt/log-firebug.php
  87. +1 −1 framework/views/pt_br/log-firebug.php
  88. +1 −1 framework/views/ro/log-firebug.php
  89. +1 −1 framework/views/ru/log-firebug.php
  90. +1 −1 framework/views/sk/log-firebug.php
  91. +1 −1 framework/views/sv/exception.php
  92. +1 −1 framework/views/sv/log-firebug.php
  93. +1 −1 framework/views/uk/exception.php
  94. +1 −1 framework/views/uk/log-firebug.php
  95. +1 −1 framework/views/vi/log-firebug.php
  96. +1 −1 framework/views/zh_cn/log-firebug.php
  97. +1 −1 framework/views/zh_tw/log-firebug.php
  98. +1 −1 framework/web/CActiveDataProvider.php
  99. +4 −4 framework/web/CAssetManager.php
  100. +3 −3 framework/web/CClientScript.php
  101. +6 −6 framework/web/CController.php
  102. +2 −2 framework/web/CDbHttpSession.php
  103. +8 −8 framework/web/CHttpRequest.php
  104. +3 −3 framework/web/CHttpSession.php
  105. +6 −6 framework/web/CSort.php
  106. +1 −1 framework/web/CTheme.php
  107. +1 −1 framework/web/CUploadedFile.php
  108. +4 −4 framework/web/CUrlManager.php
  109. +2 −2 framework/web/actions/CAction.php
  110. +5 −5 framework/web/auth/CAccessControlFilter.php
  111. +4 −4 framework/web/auth/CDbAuthManager.php
  112. +2 −2 framework/web/auth/CPhpAuthManager.php
  113. +1 −1 framework/web/auth/CWebUser.php
  114. +1 −1 framework/web/filters/CFilterChain.php
  115. +5 −5 framework/web/filters/CHttpCacheFilter.php
  116. +2 −2 framework/web/form/CForm.php
  117. +1 −1 framework/web/form/CFormButtonElement.php
  118. +1 −1 framework/web/form/CFormElement.php
  119. +2 −2 framework/web/form/CFormElementCollection.php
  120. +10 −10 framework/web/helpers/CHtml.php
  121. +8 −8 framework/web/helpers/CJavaScript.php
  122. +7 −7 framework/web/renderers/CPradoViewRenderer.php
  123. +1 −1 framework/web/services/CWebService.php
  124. +3 −3 framework/web/services/CWsdlGenerator.php
  125. +2 −2 framework/web/widgets/CInputWidget.php
  126. +4 −4 framework/web/widgets/COutputCache.php
  127. +1 −1 framework/web/widgets/CTabView.php
  128. +1 −1 framework/web/widgets/CTreeView.php
  129. +3 −3 framework/web/widgets/CWidget.php
  130. +1 −1 framework/web/widgets/views/flexWidget.php
  131. +1 −1 framework/zii/behaviors/CTimestampBehavior.php
  132. +1 −1 framework/zii/widgets/CBaseListView.php
  133. +1 −1 framework/zii/widgets/CBreadcrumbs.php
  134. +3 −3 framework/zii/widgets/CDetailView.php
  135. +1 −1 framework/zii/widgets/CMenu.php
  136. +1 −1 framework/zii/widgets/grid/CButtonColumn.php
  137. +2 −2 framework/zii/widgets/grid/CCheckBoxColumn.php
  138. +4 −4 framework/zii/widgets/grid/CDataColumn.php
  139. +3 −3 framework/zii/widgets/grid/CGridView.php
  140. +2 −2 framework/zii/widgets/jui/CJuiInputWidget.php
  141. +2 −2 framework/zii/widgets/jui/CJuiWidget.php
View
12 framework/YiiBase.php
@@ -184,7 +184,7 @@ public static function createComponent($config)
$type=$config;
$config=array();
}
- else if(isset($config['class']))
+ elseif(isset($config['class']))
{
$type=$config['class'];
unset($config['class']);
@@ -200,9 +200,9 @@ public static function createComponent($config)
$args=func_get_args();
if($n===2)
$object=new $type($args[1]);
- else if($n===3)
+ elseif($n===3)
$object=new $type($args[1],$args[2]);
- else if($n===4)
+ elseif($n===4)
$object=new $type($args[1],$args[2],$args[3]);
else
{
@@ -353,12 +353,12 @@ public static function getPathOfAlias($alias)
{
if(isset(self::$_aliases[$alias]))
return self::$_aliases[$alias];
- else if(($pos=strpos($alias,'.'))!==false)
+ elseif(($pos=strpos($alias,'.'))!==false)
{
$rootAlias=substr($alias,0,$pos);
if(isset(self::$_aliases[$rootAlias]))
return self::$_aliases[$alias]=rtrim(self::$_aliases[$rootAlias].DIRECTORY_SEPARATOR.str_replace('.',DIRECTORY_SEPARATOR,substr($alias,$pos+1)),'*'.DIRECTORY_SEPARATOR);
- else if(self::$_app instanceof CWebApplication)
+ elseif(self::$_app instanceof CWebApplication)
{
if(self::$_app->findModule($rootAlias)!==null)
return self::getPathOfAlias($alias);
@@ -393,7 +393,7 @@ public static function autoload($className)
// use include so that the error PHP file may appear
if(isset(self::$classMap[$className]))
include(self::$classMap[$className]);
- else if(isset(self::$_coreClasses[$className]))
+ elseif(isset(self::$_coreClasses[$className]))
include(YII_PATH.self::$_coreClasses[$className]);
else
{
View
2 framework/base/CApplication.php
@@ -626,7 +626,7 @@ public function setGlobalState($key,$value,$defaultValue=null)
$this->_stateChanged=true;
}
}
- else if(!isset($this->_globalState[$key]) || $this->_globalState[$key]!==$value)
+ elseif(!isset($this->_globalState[$key]) || $this->_globalState[$key]!==$value)
{
$this->_globalState[$key]=$value;
$this->_stateChanged=true;
View
28 framework/base/CComponent.php
@@ -109,7 +109,7 @@ public function __get($name)
$getter='get'.$name;
if(method_exists($this,$getter))
return $this->$getter();
- else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
+ elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
{
// duplicating getEventHandlers() here for performance
$name=strtolower($name);
@@ -117,9 +117,9 @@ public function __get($name)
$this->_e[$name]=new CList;
return $this->_e[$name];
}
- else if(isset($this->_m[$name]))
+ elseif(isset($this->_m[$name]))
return $this->_m[$name];
- else if(is_array($this->_m))
+ elseif(is_array($this->_m))
{
foreach($this->_m as $object)
{
@@ -150,7 +150,7 @@ public function __set($name,$value)
$setter='set'.$name;
if(method_exists($this,$setter))
return $this->$setter($value);
- else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
+ elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
{
// duplicating getEventHandlers() here for performance
$name=strtolower($name);
@@ -158,7 +158,7 @@ public function __set($name,$value)
$this->_e[$name]=new CList;
return $this->_e[$name]->add($value);
}
- else if(is_array($this->_m))
+ elseif(is_array($this->_m))
{
foreach($this->_m as $object)
{
@@ -186,12 +186,12 @@ public function __isset($name)
$getter='get'.$name;
if(method_exists($this,$getter))
return $this->$getter()!==null;
- else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
+ elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
{
$name=strtolower($name);
return isset($this->_e[$name]) && $this->_e[$name]->getCount();
}
- else if(is_array($this->_m))
+ elseif(is_array($this->_m))
{
if(isset($this->_m[$name]))
return true;
@@ -217,9 +217,9 @@ public function __unset($name)
$setter='set'.$name;
if(method_exists($this,$setter))
$this->$setter(null);
- else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
+ elseif(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
unset($this->_e[strtolower($name)]);
- else if(is_array($this->_m))
+ elseif(is_array($this->_m))
{
if(isset($this->_m[$name]))
$this->detachBehavior($name);
@@ -231,13 +231,13 @@ public function __unset($name)
{
if(property_exists($object,$name))
return $object->$name=null;
- else if($object->canSetProperty($name))
+ elseif($object->canSetProperty($name))
return $object->$setter(null);
}
}
}
}
- else if(method_exists($this,'get'.$name))
+ elseif(method_exists($this,'get'.$name))
throw new CException(Yii::t('yii','Property "{class}.{property}" is read only.',
array('{class}'=>get_class($this), '{property}'=>$name)));
}
@@ -546,7 +546,7 @@ public function raiseEvent($name,$event)
{
if(is_string($handler))
call_user_func($handler,$event);
- else if(is_callable($handler,true))
+ elseif(is_callable($handler,true))
{
if(is_array($handler))
{
@@ -554,7 +554,7 @@ public function raiseEvent($name,$event)
list($object,$method)=$handler;
if(is_string($object)) // static method call
call_user_func($handler,$event);
- else if(method_exists($object,$method))
+ elseif(method_exists($object,$method))
$object->$method($event);
else
throw new CException(Yii::t('yii','Event "{class}.{event}" is attached with an invalid handler "{handler}".',
@@ -571,7 +571,7 @@ public function raiseEvent($name,$event)
return;
}
}
- else if(YII_DEBUG && !$this->hasEvent($name))
+ elseif(YII_DEBUG && !$this->hasEvent($name))
throw new CException(Yii::t('yii','Event "{class}.{event}" is not defined.',
array('{class}'=>get_class($this), '{event}'=>$name)));
}
View
14 framework/base/CErrorHandler.php
@@ -283,7 +283,7 @@ protected function handleError($event)
header("HTTP/1.0 500 Internal Server Error");
if($this->isAjaxRequest())
$app->displayError($event->code,$event->message,$event->file,$event->line);
- else if(YII_DEBUG)
+ elseif(YII_DEBUG)
$this->render('exception',$data);
else
$this->render('error',$data);
@@ -430,27 +430,27 @@ protected function argumentsToString($args)
if(is_object($value))
$args[$key] = get_class($value);
- else if(is_bool($value))
+ elseif(is_bool($value))
$args[$key] = $value ? 'true' : 'false';
- else if(is_string($value))
+ elseif(is_string($value))
{
if(strlen($value)>64)
$args[$key] = '"'.substr($value,0,64).'..."';
else
$args[$key] = '"'.$value.'"';
}
- else if(is_array($value))
+ elseif(is_array($value))
$args[$key] = 'array('.$this->argumentsToString($value).')';
- else if($value===null)
+ elseif($value===null)
$args[$key] = 'null';
- else if(is_resource($value))
+ elseif(is_resource($value))
$args[$key] = 'resource';
if(is_string($key))
{
$args[$key] = '"'.$key.'" => '.$args[$key];
}
- else if($isAssoc)
+ elseif($isAssoc)
{
$args[$key] = $key.' => '.$args[$key];
}
View
2 framework/base/CModel.php
@@ -469,7 +469,7 @@ public function setAttributes($values,$safeOnly=true)
{
if(isset($attributes[$name]))
$this->$name=$value;
- else if($safeOnly)
+ elseif($safeOnly)
$this->onUnsafeAttribute($name,$value);
}
}
View
4 framework/base/CModule.php
@@ -270,7 +270,7 @@ public function getModule($id)
{
if(isset($this->_modules[$id]) || array_key_exists($id,$this->_modules))
return $this->_modules[$id];
- else if(isset($this->_moduleConfig[$id]))
+ elseif(isset($this->_moduleConfig[$id]))
{
$config=$this->_moduleConfig[$id];
if(!isset($config['enabled']) || $config['enabled'])
@@ -376,7 +376,7 @@ public function getComponent($id,$createIfNull=true)
{
if(isset($this->_components[$id]))
return $this->_components[$id];
- else if(isset($this->_componentConfig[$id]) && $createIfNull)
+ elseif(isset($this->_componentConfig[$id]) && $createIfNull)
{
$config=$this->_componentConfig[$id];
if(!isset($config['enabled']) || $config['enabled'])
View
4 framework/base/CStatePersister.php
@@ -82,7 +82,7 @@ public function load()
$cacheKey='Yii.CStatePersister.'.$stateFile;
if(($value=$cache->get($cacheKey))!==false)
return unserialize($value);
- else if(($content=@file_get_contents($stateFile))!==false)
+ elseif(($content=@file_get_contents($stateFile))!==false)
{
$cache->set($cacheKey,$content,0,new CFileCacheDependency($stateFile));
return unserialize($content);
@@ -90,7 +90,7 @@ public function load()
else
return null;
}
- else if(($content=@file_get_contents($stateFile))!==false)
+ elseif(($content=@file_get_contents($stateFile))!==false)
return unserialize($content);
else
return null;
View
4 framework/caching/CDbCache.php
@@ -124,7 +124,7 @@ protected function createCacheTable($db,$tableName)
$driver=$db->getDriverName();
if($driver==='mysql')
$blob='LONGBLOB';
- else if($driver==='pgsql')
+ elseif($driver==='pgsql')
$blob='BYTEA';
else
$blob='BLOB';
@@ -147,7 +147,7 @@ public function getDbConnection()
{
if($this->_db!==null)
return $this->_db;
- else if(($id=$this->connectionID)!==null)
+ elseif(($id=$this->connectionID)!==null)
{
if(($this->_db=Yii::app()->getComponent($id)) instanceof CDbConnection)
return $this->_db;
View
4 framework/caching/CFileCache.php
@@ -105,7 +105,7 @@ protected function getValue($key)
$cacheFile=$this->getCacheFile($key);
if(($time=@filemtime($cacheFile))>time())
return @file_get_contents($cacheFile);
- else if($time>0)
+ elseif($time>0)
@unlink($cacheFile);
return false;
}
@@ -212,7 +212,7 @@ public function gc($expiredOnly=true,$path=null)
$fullPath=$path.DIRECTORY_SEPARATOR.$file;
if(is_dir($fullPath))
$this->gc($expiredOnly,$fullPath);
- else if($expiredOnly && @filemtime($fullPath)<time() || !$expiredOnly)
+ elseif($expiredOnly && @filemtime($fullPath)<time() || !$expiredOnly)
@unlink($fullPath);
}
closedir($handle);
View
2 framework/cli/commands/MigrateCommand.php
@@ -439,7 +439,7 @@ protected function getDbConnection()
{
if($this->_db!==null)
return $this->_db;
- else if(($this->_db=Yii::app()->getComponent($this->connectionID)) instanceof CDbConnection)
+ elseif(($this->_db=Yii::app()->getComponent($this->connectionID)) instanceof CDbConnection)
return $this->_db;
echo "Error: CMigrationCommand.connectionID '{$this->connectionID}' is invalid. Please make sure it refers to the ID of a CDbConnection application component.\n";
View
6 framework/cli/commands/shell/CrudCommand.php
@@ -196,7 +196,7 @@ public function generateController($source,$params)
$id=$model->tableSchema->primaryKey;
if($id===null)
throw new ShellException(Yii::t('yii','Error: Table "{table}" does not have a primary key.',array('{table}'=>$model->tableName())));
- else if(is_array($id))
+ elseif(is_array($id))
throw new ShellException(Yii::t('yii','Error: Table "{table}" has a composite primary key which is not supported by crud command.',array('{table}'=>$model->tableName())));
if(!is_file($source)) // fall back to default ones
@@ -243,7 +243,7 @@ public function generateInputField($modelClass,$column)
{
if($column->type==='boolean')
return "CHtml::activeCheckBox(\$model,'{$column->name}')";
- else if(stripos($column->dbType,'text')!==false)
+ elseif(stripos($column->dbType,'text')!==false)
return "CHtml::activeTextArea(\$model,'{$column->name}',array('rows'=>6, 'cols'=>50))";
else
{
@@ -272,7 +272,7 @@ public function generateActiveField($modelClass,$column)
{
if($column->type==='boolean')
return "\$form->checkBox(\$model,'{$column->name}')";
- else if(stripos($column->dbType,'text')!==false)
+ elseif(stripos($column->dbType,'text')!==false)
return "\$form->textArea(\$model,'{$column->name}',array('rows'=>6, 'cols'=>50))";
else
{
View
8 framework/cli/commands/shell/ModelCommand.php
@@ -205,7 +205,7 @@ protected function generateClassNames($schema,$pattern=null)
{
if($pattern===null)
$this->_tables[$name]=$this->generateClassName($this->removePrefix($name));
- else if(preg_match($pattern,$name,$matches))
+ elseif(preg_match($pattern,$name,$matches))
{
if(count($matches)>1 && !empty($matches[1]))
$className=$this->generateClassName($matches[1]);
@@ -406,11 +406,11 @@ public function generateModel($source,$params)
$required[]=$column->name;
if($column->type==='integer')
$integers[]=$column->name;
- else if($column->type==='double')
+ elseif($column->type==='double')
$numerical[]=$column->name;
- else if($column->type==='string' && $column->size>0)
+ elseif($column->type==='string' && $column->size>0)
$length[$column->size][]=$column->name;
- else if(!$column->isPrimaryKey && !$r)
+ elseif(!$column->isPrimaryKey && !$r)
$safe[]=$column->name;
}
if($required!==array())
View
2 framework/cli/views/webapp/protected/components/UserIdentity.php
@@ -24,7 +24,7 @@ public function authenticate()
);
if(!isset($users[$this->username]))
$this->errorCode=self::ERROR_USERNAME_INVALID;
- else if($users[$this->username]!==$this->password)
+ elseif($users[$this->username]!==$this->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
$this->errorCode=self::ERROR_NONE;
View
8 framework/collections/CList.php
@@ -120,7 +120,7 @@ public function itemAt($index)
{
if(isset($this->_d[$index]))
return $this->_d[$index];
- else if($index>=0 && $index<$this->_c) // in case the value is null
+ elseif($index>=0 && $index<$this->_c) // in case the value is null
return $this->_d[$index];
else
throw new CException(Yii::t('yii','List index "{index}" is out of bound.',
@@ -152,7 +152,7 @@ public function insertAt($index,$item)
{
if($index===$this->_c)
$this->_d[$this->_c++]=$item;
- else if($index>=0 && $index<$this->_c)
+ elseif($index>=0 && $index<$this->_c)
{
array_splice($this->_d,$index,0,array($item));
$this->_c++;
@@ -269,7 +269,7 @@ public function copyFrom($data)
foreach($data as $item)
$this->add($item);
}
- else if($data!==null)
+ elseif($data!==null)
throw new CException(Yii::t('yii','List data must be an array or an object implementing Traversable.'));
}
@@ -288,7 +288,7 @@ public function mergeWith($data)
foreach($data as $item)
$this->add($item);
}
- else if($data!==null)
+ elseif($data!==null)
throw new CException(Yii::t('yii','List data must be an array or an object implementing Traversable.'));
}
View
6 framework/collections/CMap.php
@@ -214,7 +214,7 @@ public function copyFrom($data)
foreach($data as $key=>$value)
$this->add($key,$value);
}
- else if($data!==null)
+ elseif($data!==null)
throw new CException(Yii::t('yii','Map data must be an array or an object implementing Traversable.'));
}
@@ -259,7 +259,7 @@ public function mergeWith($data,$recursive=true)
$this->add($key,$value);
}
}
- else if($data!==null)
+ elseif($data!==null)
throw new CException(Yii::t('yii','Map data must be an array or an object implementing Traversable.'));
}
@@ -288,7 +288,7 @@ public static function mergeArray($a,$b)
{
if(is_integer($k))
isset($res[$k]) ? $res[]=$v : $res[$k]=$v;
- else if(is_array($v) && isset($res[$k]) && is_array($res[$k]))
+ elseif(is_array($v) && isset($res[$k]) && is_array($res[$k]))
$res[$k]=self::mergeArray($res[$k],$v);
else
$res[$k]=$v;
View
2 framework/collections/CQueue.php
@@ -79,7 +79,7 @@ public function copyFrom($data)
++$this->_c;
}
}
- else if($data!==null)
+ elseif($data!==null)
throw new CException(Yii::t('yii','Queue data must be an array or an object implementing Traversable.'));
}
View
2 framework/collections/CStack.php
@@ -79,7 +79,7 @@ public function copyFrom($data)
++$this->_c;
}
}
- else if($data!==null)
+ elseif($data!==null)
throw new CException(Yii::t('yii','Stack data must be an array or an object implementing Traversable.'));
}
View
12 framework/console/CConsoleCommand.php
@@ -131,14 +131,14 @@ public function run($args)
{
if($param->isArray())
$params[]=is_array($options[$name]) ? $options[$name] : array($options[$name]);
- else if(!is_array($options[$name]))
+ elseif(!is_array($options[$name]))
$params[]=$options[$name];
else
$this->usageError("Option --$name requires a scalar. Array is given.");
}
- else if($name==='args')
+ elseif($name==='args')
$params[]=$args;
- else if($param->isDefaultValueAvailable())
+ elseif($param->isDefaultValueAvailable())
$params[]=$param->getDefaultValue();
else
$this->usageError("Missing required option --$name.");
@@ -237,7 +237,7 @@ protected function resolveRequest($args)
else
$options[$name]=$value;
}
- else if(isset($action))
+ elseif(isset($action))
$params[]=$arg;
else
$action=$arg;
@@ -386,9 +386,9 @@ public function copyFiles($fileList)
$answer=trim(fgets(STDIN));
if(!strncasecmp($answer,'q',1))
return;
- else if(!strncasecmp($answer,'y',1))
+ elseif(!strncasecmp($answer,'y',1))
echo " overwrite $name\n";
- else if(!strncasecmp($answer,'a',1))
+ elseif(!strncasecmp($answer,'a',1))
{
echo " overwrite $name\n";
$overwriteAll=true;
View
2 framework/console/CConsoleCommandRunner.php
@@ -147,7 +147,7 @@ public function createCommand($name)
else // an array configuration
return Yii::createComponent($command,$name,$this);
}
- else if($name==='help')
+ elseif($name==='help')
return new CHelpCommand('help',$this);
else
return null;
View
12 framework/db/CDbCommand.php
@@ -246,9 +246,9 @@ public function bindParam($name, &$value, $dataType=null, $length=null, $driverO
$this->prepare();
if($dataType===null)
$this->_statement->bindParam($name,$value,$this->_connection->getPdoType(gettype($value)));
- else if($length===null)
+ elseif($length===null)
$this->_statement->bindParam($name,$value,$dataType);
- else if($driverOptions===null)
+ elseif($driverOptions===null)
$this->_statement->bindParam($name,$value,$dataType,$length);
else
$this->_statement->bindParam($name,$value,$dataType,$length,$driverOptions);
@@ -599,7 +599,7 @@ public function select($columns='*', $option='')
{
if(is_object($column))
$columns[$i]=(string)$column;
- else if(strpos($column,'(')===false)
+ elseif(strpos($column,'(')===false)
{
if(preg_match('/^(.*?)(?i:\s+as\s+|\s+)(.*)$/',$column,$matches))
$columns[$i]=$this->_connection->quoteColumnName($matches[1]).' AS '.$this->_connection->quoteColumnName($matches[2]);
@@ -964,7 +964,7 @@ public function group($columns)
{
if(is_object($column))
$columns[$i]=(string)$column;
- else if(strpos($column,'(')===false)
+ elseif(strpos($column,'(')===false)
$columns[$i]=$this->_connection->quoteColumnName($column);
}
$this->_query['group']=implode(', ',$columns);
@@ -1051,7 +1051,7 @@ public function order($columns)
{
if(is_object($column))
$columns[$i]=(string)$column;
- else if(strpos($column,'(')===false)
+ elseif(strpos($column,'(')===false)
{
if(preg_match('/^(.*?)\s+(asc|desc)$/i',$column,$matches))
$columns[$i]=$this->_connection->quoteColumnName($matches[1]).' '.strtoupper($matches[2]);
@@ -1459,7 +1459,7 @@ private function processConditions($conditions)
{
if(!is_array($conditions))
return $conditions;
- else if($conditions===array())
+ elseif($conditions===array())
return '';
$n=count($conditions);
$operator=strtoupper($conditions[0]);
View
2 framework/db/CDbConnection.php
@@ -416,7 +416,7 @@ protected function createPdoInstance()
$driver=strtolower(substr($this->connectionString,0,$pos));
if($driver==='mssql' || $driver==='dblib')
$pdoClass='CMssqlPdoAdapter';
- else if($driver==='sqlsrv')
+ elseif($driver==='sqlsrv')
$pdoClass='CMssqlSqlsrvPdoAdapter';
}
return new $pdoClass($this->connectionString,$this->username,
View
32 framework/db/ar/CActiveFinder.php
@@ -80,7 +80,7 @@ public function query($criteria,$all=false)
$result=$array;
}
}
- else if(count($this->_joinTree->records))
+ elseif(count($this->_joinTree->records))
$result = reset($this->_joinTree->records);
else
$result = null;
@@ -219,7 +219,7 @@ private function buildJoinTree($parent,$with,$options=null)
$oldAlias=$model->getTableAlias(false,false);
if(isset($options['alias']))
$model->setTableAlias($options['alias']);
- else if($relation->alias===null)
+ elseif($relation->alias===null)
$model->setTableAlias($relation->name);
else
$model->setTableAlias($relation->alias);
@@ -274,7 +274,7 @@ private function buildJoinTree($parent,$with,$options=null)
{
if(is_string($value)) // the value is a relation name
$this->buildJoinTree($parent,$value);
- else if(is_string($key) && is_array($value))
+ elseif(is_string($key) && is_array($value))
$this->buildJoinTree($parent,$key,$value);
}
}
@@ -383,7 +383,7 @@ public function __construct($finder,$relation,$parent=null,$id=0)
$this->_columnAliases[$name]=$alias;
if($table->primaryKey===$name)
$this->_pkAlias=$alias;
- else if(is_array($table->primaryKey) && in_array($name,$table->primaryKey))
+ elseif(is_array($table->primaryKey) && in_array($name,$table->primaryKey))
$this->_pkAlias[$name]=$alias;
}
}
@@ -416,7 +416,7 @@ public function find($criteria=null)
$this->_finder->baseLimited=false;
$this->runQuery($query);
}
- else if(!$this->_joined && !empty($this->_parent->records)) // not joined before
+ elseif(!$this->_joined && !empty($this->_parent->records)) // not joined before
{
$query=new CJoinQuery($this->_parent);
$this->_joined=true;
@@ -546,7 +546,7 @@ private function applyLazyCondition($query,$record)
$params[':ypl'.$count]=$record->$pk;
$count++;
}
- else if(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
+ elseif(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
$childCondition[$pk]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
else
{
@@ -624,7 +624,7 @@ private function applyLazyCondition($query,$record)
{
if(isset($parent->_table->foreignKeys[$fk])) // FK defined
$pk=$parent->_table->foreignKeys[$fk][1];
- else if(is_array($this->_table->primaryKey)) // composite PK
+ elseif(is_array($this->_table->primaryKey)) // composite PK
$pk=$this->_table->primaryKey[$i];
else
$pk=$this->_table->primaryKey;
@@ -637,7 +637,7 @@ private function applyLazyCondition($query,$record)
{
if(isset($this->_table->foreignKeys[$fk])) // FK defined
$pk=$this->_table->foreignKeys[$fk][1];
- else if(is_array($parent->_table->primaryKey)) // composite PK
+ elseif(is_array($parent->_table->primaryKey)) // composite PK
$pk=$parent->_table->primaryKey[$i];
else
$pk=$parent->_table->primaryKey;
@@ -706,7 +706,7 @@ public function count($criteria=null)
$select=is_array($criteria->select) ? implode(',',$criteria->select) : $criteria->select;
if($select!=='*' && !strncasecmp($select,'count',5))
$query->selects=array($select);
- else if(is_string($this->_table->primaryKey))
+ elseif(is_string($this->_table->primaryKey))
{
$prefix=$this->getColumnPrefix();
$schema=$this->_builder->getSchema();
@@ -745,7 +745,7 @@ public function buildQuery($query)
{
if($child->master!==null)
$child->_joined=true;
- else if($child->relation instanceof CHasOneRelation || $child->relation instanceof CBelongsToRelation
+ elseif($child->relation instanceof CHasOneRelation || $child->relation instanceof CBelongsToRelation
|| $this->_finder->joinAll || $child->relation->together || (!$this->_finder->baseLimited && $child->relation->together===null))
{
$child->_joined=true;
@@ -907,7 +907,7 @@ public function getColumnSelect($select='*')
$columns[]=$prefix.$schema->quoteColumnName($key).' AS '.$schema->quoteColumnName($this->_columnAliases[$key]);
$selected[$this->_columnAliases[$key]]=1;
}
- else if(preg_match('/^(.*?)\s+AS\s+(\w+)$/im',$name,$matches)) // if the column is already aliased
+ elseif(preg_match('/^(.*?)\s+AS\s+(\w+)$/im',$name,$matches)) // if the column is already aliased
{
$alias=$matches[2];
if(!isset($this->_columnAliases[$alias]) || $this->_columnAliases[$alias]!==$alias)
@@ -924,7 +924,7 @@ public function getColumnSelect($select='*')
// add primary key selection if they are not selected
if(is_string($this->_pkAlias) && !isset($selected[$this->_pkAlias]))
$columns[]=$prefix.$schema->quoteColumnName($this->_table->primaryKey).' AS '.$schema->quoteColumnName($this->_pkAlias);
- else if(is_array($this->_pkAlias))
+ elseif(is_array($this->_pkAlias))
{
foreach($this->_table->primaryKey as $name)
if(!isset($selected[$name]))
@@ -945,7 +945,7 @@ public function getPrimaryKeySelect()
$columns=array();
if(is_string($this->_pkAlias))
$columns[]=$prefix.$schema->quoteColumnName($this->_table->primaryKey).' AS '.$schema->quoteColumnName($this->_pkAlias);
- else if(is_array($this->_pkAlias))
+ elseif(is_array($this->_pkAlias))
{
foreach($this->_pkAlias as $name=>$alias)
$columns[]=$prefix.$schema->quoteColumnName($name).' AS '.$schema->quoteColumnName($alias);
@@ -1005,7 +1005,7 @@ public function getJoinCondition()
$pke=$this;
$fke=$parent;
}
- else if($this->slave===null)
+ elseif($this->slave===null)
{
$pke=$parent;
$fke=$this;
@@ -1094,7 +1094,7 @@ private function joinManyMany($joinTable,$fks,$parent)
list($tableName,$pk)=$joinTable->foreignKeys[$fk];
if(!isset($parentCondition[$pk]) && $schema->compareTableNames($parent->_table->rawName,$tableName))
$parentCondition[$pk]=$parent->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
- else if(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
+ elseif(!isset($childCondition[$pk]) && $schema->compareTableNames($this->_table->rawName,$tableName))
$childCondition[$pk]=$this->getColumnPrefix().$schema->quoteColumnName($pk).'='.$joinAlias.'.'.$schema->quoteColumnName($fk);
else
{
@@ -1491,7 +1491,7 @@ private function queryManyMany($joinTableName,$keys)
list($tableName,$pk)=$joinTable->foreignKeys[$fk];
if(!isset($joinCondition[$pk]) && $schema->compareTableNames($table->rawName,$tableName))
$joinCondition[$pk]=$tableAlias.'.'.$schema->quoteColumnName($pk).'='.$joinTable->rawName.'.'.$schema->quoteColumnName($fk);
- else if(!isset($map[$pk]) && $schema->compareTableNames($pkTable->rawName,$tableName))
+ elseif(!isset($map[$pk]) && $schema->compareTableNames($pkTable->rawName,$tableName))
$map[$pk]=$fk;
else
{
View
56 framework/db/ar/CActiveRecord.php
@@ -133,11 +133,11 @@ public function __get($name)
{
if(isset($this->_attributes[$name]))
return $this->_attributes[$name];
- else if(isset($this->getMetaData()->columns[$name]))
+ elseif(isset($this->getMetaData()->columns[$name]))
return null;
- else if(isset($this->_related[$name]))
+ elseif(isset($this->_related[$name]))
return $this->_related[$name];
- else if(isset($this->getMetaData()->relations[$name]))
+ elseif(isset($this->getMetaData()->relations[$name]))
return $this->getRelated($name);
else
return parent::__get($name);
@@ -171,11 +171,11 @@ public function __isset($name)
{
if(isset($this->_attributes[$name]))
return true;
- else if(isset($this->getMetaData()->columns[$name]))
+ elseif(isset($this->getMetaData()->columns[$name]))
return false;
- else if(isset($this->_related[$name]))
+ elseif(isset($this->_related[$name]))
return true;
- else if(isset($this->getMetaData()->relations[$name]))
+ elseif(isset($this->getMetaData()->relations[$name]))
return $this->getRelated($name)!==null;
else
return parent::__isset($name);
@@ -191,7 +191,7 @@ public function __unset($name)
{
if(isset($this->getMetaData()->columns[$name]))
unset($this->_attributes[$name]);
- else if(isset($this->getMetaData()->relations[$name]))
+ elseif(isset($this->getMetaData()->relations[$name]))
unset($this->_related[$name]);
else
parent::__unset($name);
@@ -275,7 +275,7 @@ public function getRelated($name,$refresh=false,$params=array())
{
if($relation instanceof CHasManyRelation)
$this->_related[$name]=array();
- else if($relation instanceof CStatRelation)
+ elseif($relation instanceof CStatRelation)
$this->_related[$name]=$relation->defaultValue;
else
$this->_related[$name]=null;
@@ -589,7 +589,7 @@ public function getAttributeLabel($attribute)
$labels=$this->attributeLabels();
if(isset($labels[$attribute]))
return $labels[$attribute];
- else if(strpos($attribute,'.')!==false)
+ elseif(strpos($attribute,'.')!==false)
{
$segs=explode('.',$attribute);
$name=array_pop($segs);
@@ -681,7 +681,7 @@ public function getAttribute($name)
{
if(property_exists($this,$name))
return $this->$name;
- else if(isset($this->_attributes[$name]))
+ elseif(isset($this->_attributes[$name]))
return $this->_attributes[$name];
}
@@ -697,7 +697,7 @@ public function setAttribute($name,$value)
{
if(property_exists($this,$name))
$this->$name=$value;
- else if(isset($this->getMetaData()->columns[$name]))
+ elseif(isset($this->getMetaData()->columns[$name]))
$this->_attributes[$name]=$value;
else
return false;
@@ -727,7 +727,7 @@ public function addRelatedRecord($name,$record,$index)
$this->_related[$name][$index]=$record;
}
}
- else if(!isset($this->_related[$name]))
+ elseif(!isset($this->_related[$name]))
$this->_related[$name]=$record;
}
@@ -747,7 +747,7 @@ public function getAttributes($names=true)
{
if(property_exists($this,$name))
$attributes[$name]=$this->$name;
- else if($names===true && !isset($attributes[$name]))
+ elseif($names===true && !isset($attributes[$name]))
$attributes[$name]=null;
}
if(is_array($names))
@@ -1027,7 +1027,7 @@ public function insert($attributes=null)
{
if(is_string($primaryKey) && $this->$primaryKey===null)
$this->$primaryKey=$builder->getLastInsertID($table);
- else if(is_array($primaryKey))
+ elseif(is_array($primaryKey))
{
foreach($primaryKey as $pk)
{
@@ -1221,7 +1221,7 @@ public function getPrimaryKey()
$table=$this->getMetaData()->tableSchema;
if(is_string($table->primaryKey))
return $this->{$table->primaryKey};
- else if(is_array($table->primaryKey))
+ elseif(is_array($table->primaryKey))
{
$values=array();
foreach($table->primaryKey as $name)
@@ -1245,7 +1245,7 @@ public function setPrimaryKey($value)
$table=$this->getMetaData()->tableSchema;
if(is_string($table->primaryKey))
$this->{$table->primaryKey}=$value;
- else if(is_array($table->primaryKey))
+ elseif(is_array($table->primaryKey))
{
foreach($table->primaryKey as $name)
$this->$name=$value[$name];
@@ -1329,13 +1329,13 @@ public function applyScopes(&$criteria)
$scope=$v;
$params=array();
}
- else if(is_array($v))
+ elseif(is_array($v))
{
$scope=key($v);
$params=current($v);
}
}
- else if(is_string($k))
+ elseif(is_string($k))
{
$scope=$k;
$params=$v;
@@ -1800,7 +1800,7 @@ public function populateRecord($attributes,$callAfterFind=true)
{
if(property_exists($record,$name))
$record->$name=$value;
- else if(isset($md->columns[$name]))
+ elseif(isset($md->columns[$name]))
$record->_attributes[$name]=$value;
}
$record->_pk=$record->getPrimaryKey();
@@ -1954,7 +1954,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->select==='*')
$this->select=$criteria['select'];
- else if($criteria['select']!=='*')
+ elseif($criteria['select']!=='*')
{
$select1=is_string($this->select)?preg_split('/\s*,\s*/',trim($this->select),-1,PREG_SPLIT_NO_EMPTY):$this->select;
$select2=is_string($criteria['select'])?preg_split('/\s*,\s*/',trim($criteria['select']),-1,PREG_SPLIT_NO_EMPTY):$criteria['select'];
@@ -1966,7 +1966,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->condition==='')
$this->condition=$criteria['condition'];
- else if($criteria['condition']!=='')
+ elseif($criteria['condition']!=='')
$this->condition="({$this->condition}) AND ({$criteria['condition']})";
}
@@ -1977,7 +1977,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->order==='')
$this->order=$criteria['order'];
- else if($criteria['order']!=='')
+ elseif($criteria['order']!=='')
$this->order=$criteria['order'].', '.$this->order;
}
@@ -1985,7 +1985,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->group==='')
$this->group=$criteria['group'];
- else if($criteria['group']!=='')
+ elseif($criteria['group']!=='')
$this->group.=', '.$criteria['group'];
}
@@ -1993,7 +1993,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->join==='')
$this->join=$criteria['join'];
- else if($criteria['join']!=='')
+ elseif($criteria['join']!=='')
$this->join.=' '.$criteria['join'];
}
@@ -2001,7 +2001,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->having==='')
$this->having=$criteria['having'];
- else if($criteria['having']!=='')
+ elseif($criteria['having']!=='')
$this->having="({$this->having}) AND ({$criteria['having']})";
}
}
@@ -2105,7 +2105,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->on==='')
$this->on=$criteria['condition'];
- else if($criteria['condition']!=='')
+ elseif($criteria['condition']!=='')
$this->on="({$this->on}) AND ({$criteria['condition']})";
}
unset($criteria['condition']);
@@ -2120,7 +2120,7 @@ public function mergeWith($criteria,$fromScope=false)
{
if($this->on==='')
$this->on=$criteria['on'];
- else if($criteria['on']!=='')
+ elseif($criteria['on']!=='')
$this->on="({$this->on}) AND ({$criteria['on']})";
}
@@ -2314,7 +2314,7 @@ public function __construct($model)
$table->primaryKey=$model->primaryKey();
if(is_string($table->primaryKey) && isset($table->columns[$table->primaryKey]))
$table->columns[$table->primaryKey]->isPrimaryKey=true;
- else if(is_array($table->primaryKey))
+ elseif(is_array($table->primaryKey))
{
foreach($table->primaryKey as $name)
{
View
4 framework/db/schema/CDbColumnSchema.php
@@ -97,9 +97,9 @@ protected function extractType($dbType)
{
if(stripos($dbType,'int')!==false && stripos($dbType,'unsigned int')===false)
$this->type='integer';
- else if(stripos($dbType,'bool')!==false)
+ elseif(stripos($dbType,'bool')!==false)
$this->type='boolean';
- else if(preg_match('/(real|floa|doub)/i',$dbType))
+ elseif(preg_match('/(real|floa|doub)/i',$dbType))
$this->type='double';
else
$this->type='string';
View
10 framework/db/schema/CDbCommandBuilder.php
@@ -131,7 +131,7 @@ public function createCountCommand($table,$criteria,$alias='t')
{
if(is_string($criteria->select) && stripos($criteria->select,'count')===0)
$sql="SELECT ".$criteria->select;
- else if($criteria->distinct)
+ elseif($criteria->distinct)
{
if(is_array($table->primaryKey))
{
@@ -251,7 +251,7 @@ public function createUpdateCommand($table,$data,$criteria)
foreach($value->params as $n=>$v)
$values[$n]=$v;
}
- else if($bindByPosition)
+ elseif($bindByPosition)
{
$fields[]=$column->rawName.'=?';
$values[]=$column->typecast($value);
@@ -459,7 +459,7 @@ public function createCriteria($condition='',$params=array())
{
if(is_array($condition))
$criteria=new CDbCriteria($condition);
- else if($condition instanceof CDbCriteria)
+ elseif($condition instanceof CDbCriteria)
$criteria=clone $condition;
else
{
@@ -548,7 +548,7 @@ public function createColumnCriteria($table,$columns,$condition='',$params=array
{
if(is_array($value))
$conditions[]=$this->createInCondition($table,$name,$value,$prefix);
- else if($value!==null)
+ elseif($value!==null)
{
if($bindByPosition)
{
@@ -663,7 +663,7 @@ public function createInCondition($table,$columnName,$values,$prefix=null)
else
return $prefix.$column->rawName.' IN ('.implode(', ',$values).')';
}
- else if(is_array($columnName)) // composite key: $values=array(array('pk1'=>'v1','pk2'=>'v2'),array(...))
+ elseif(is_array($columnName)) // composite key: $values=array(array('pk1'=>'v1','pk2'=>'v2'),array(...))
{
foreach($columnName as $name)
{
View
24 framework/db/schema/CDbCriteria.php
@@ -428,7 +428,7 @@ public function compare($column, $value, $partialMatch=false, $operator='AND', $
if($op==='<>')
return $this->addSearchCondition($column,$value,$escape,$operator,'NOT LIKE');
}
- else if($op==='')
+ elseif($op==='')
$op='=';
$this->addCondition($column.$op.self::PARAM_PREFIX.self::$paramCount,$operator);
@@ -490,7 +490,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if($this->select==='*')
$this->select=$criteria->select;
- else if($criteria->select!=='*')
+ elseif($criteria->select!=='*')
{
$select1=is_string($this->select)?preg_split('/\s*,\s*/',trim($this->select),-1,PREG_SPLIT_NO_EMPTY):$this->select;
$select2=is_string($criteria->select)?preg_split('/\s*,\s*/',trim($criteria->select),-1,PREG_SPLIT_NO_EMPTY):$criteria->select;
@@ -502,7 +502,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if($this->condition==='')
$this->condition=$criteria->condition;
- else if($criteria->condition!=='')
+ elseif($criteria->condition!=='')
$this->condition="({$this->condition}) $and ({$criteria->condition})";
}
@@ -522,7 +522,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if($this->order==='')
$this->order=$criteria->order;
- else if($criteria->order!=='')
+ elseif($criteria->order!=='')
$this->order=$criteria->order.', '.$this->order;
}
@@ -530,7 +530,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if($this->group==='')
$this->group=$criteria->group;
- else if($criteria->group!=='')
+ elseif($criteria->group!=='')
$this->group.=', '.$criteria->group;
}
@@ -538,7 +538,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if($this->join==='')
$this->join=$criteria->join;
- else if($criteria->join!=='')
+ elseif($criteria->join!=='')
$this->join.=' '.$criteria->join;
}
@@ -546,7 +546,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if($this->having==='')
$this->having=$criteria->having;
- else if($criteria->having!=='')
+ elseif($criteria->having!=='')
$this->having="({$this->having}) $and ({$criteria->having})";
}
@@ -561,7 +561,7 @@ public function mergeWith($criteria,$useAnd=true)
if(empty($this->scopes))
$this->scopes=$criteria->scopes;
- else if(!empty($criteria->scopes))
+ elseif(!empty($criteria->scopes))
{
$scopes1=(array)$this->scopes;
$scopes2=(array)$criteria->scopes;
@@ -569,7 +569,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if(is_integer($k))
$scopes[]=$v;
- else if(isset($scopes2[$k]))
+ elseif(isset($scopes2[$k]))
$scopes[]=array($k=>$v);
else
$scopes[$k]=$v;
@@ -578,7 +578,7 @@ public function mergeWith($criteria,$useAnd=true)
{
if(is_integer($k))
$scopes[]=$v;
- else if(isset($scopes1[$k]))
+ elseif(isset($scopes1[$k]))
$scopes[]=array($k=>$v);
else
$scopes[$k]=$v;
@@ -588,14 +588,14 @@ public function mergeWith($criteria,$useAnd=true)
if(empty($this->with))
$this->with=$criteria->with;
- else if(!empty($criteria->with))
+ elseif(!empty($criteria->with))
{
$this->with=(array)$this->with;
foreach((array)$criteria->with as $k=>$v)
{
if(is_integer($k))
$this->with[]=$v;
- else if(isset($this->with[$k]))
+ elseif(isset($this->with[$k]))
{
$excludes=array();
foreach(array('joinType','on') as $opt)
View
2 framework/db/schema/CDbSchema.php
@@ -339,7 +339,7 @@ public function getColumnType($type)
{
if(isset($this->columnTypes[$type]))
return $this->columnTypes[$type];
- else if(($pos=strpos($type,' '))!==false)
+ elseif(($pos=strpos($type,' '))!==false)
{
$t=substr($type,0,$pos);
return (isset($this->columnTypes[$t]) ? $this->columnTypes[$t] : $t).substr($type,$pos);
View
4 framework/db/schema/mssql/CMssqlColumnSchema.php
@@ -43,9 +43,9 @@ protected function extractType($dbType)
{
if(strpos($dbType,'float')!==false || strpos($dbType,'real')!==false)
$this->type='double';
- else if(strpos($dbType,'bigint')===false && (strpos($dbType,'int')!==false || strpos($dbType,'smallint')!==false || strpos($dbType,'tinyint')))
+ elseif(strpos($dbType,'bigint')===false && (strpos($dbType,'int')!==false || strpos($dbType,'smallint')!==false || strpos($dbType,'tinyint')))
$this->type='integer';
- else if(strpos($dbType,'bit')!==false)
+ elseif(strpos($dbType,'bit')!==false)
$this->type='boolean';
else
$this->type='string';
View
4 framework/db/schema/mssql/CMssqlCommandBuilder.php
@@ -76,7 +76,7 @@ public function createUpdateCommand($table,$data,$criteria)
foreach($value->params as $n=>$v)
$values[$n]=$v;
}
- else if($bindByPosition)
+ elseif($bindByPosition)
{
$fields[]=$column->rawName.'=?';
$values[]=$column->typecast($value);
@@ -182,7 +182,7 @@ public function applyLimit($sql, $limit, $offset)
$offset = $offset!==null ? intval($offset) : -1;
if ($limit > 0 && $offset <= 0) //just limit
$sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i',"\\1SELECT\\2 TOP $limit", $sql);
- else if($limit > 0 && $offset > 0)
+ elseif($limit > 0 && $offset > 0)
$sql = $this->rewriteLimitOffsetSql($sql, $limit,$offset);
return $sql;
}
View
6 framework/db/schema/mysql/CMysqlColumnSchema.php
@@ -25,11 +25,11 @@ protected function extractType($dbType)
{
if(strncmp($dbType,'enum',4)===0)
$this->type='string';
- else if(strpos($dbType,'float')!==false || strpos($dbType,'double')!==false)
+ elseif(strpos($dbType,'float')!==false || strpos($dbType,'double')!==false)
$this->type='double';
- else if(strpos($dbType,'bool')!==false)
+ elseif(strpos($dbType,'bool')!==false)
$this->type='boolean';
- else if(strpos($dbType,'int')===0 && strpos($dbType,'unsigned')===false || preg_match('/(bit|tinyint|smallint|mediumint)/',$dbType))
+ elseif(strpos($dbType,'int')===0 && strpos($dbType,'unsigned')===false || preg_match('/(bit|tinyint|smallint|mediumint)/',$dbType))
$this->type='integer';
else
$this->type='string';
View
2 framework/db/schema/mysql/CMysqlSchema.php
@@ -170,7 +170,7 @@ protected function findColumns($table)
{
if($table->primaryKey===null)
$table->primaryKey=$c->name;
- else if(is_string($table->primaryKey))
+ elseif(is_string($table->primaryKey))
$table->primaryKey=array($table->primaryKey,$c->name);
else
$table->primaryKey[]=$c->name;
View
2 framework/db/schema/oci/COciSchema.php
@@ -207,7 +207,7 @@ protected function findColumns($table)