Permalink
Browse files

Merge pull request #1520 from creocoder/else-if-elseif

else if => elseif
  • Loading branch information...
2 parents 0955e63 + 4867238 commit 99e90d81c3b819cc5009b41b8467fe29727fd693 @samdark samdark committed Oct 3, 2012
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
@@ -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
{
@@ -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;
@@ -109,17 +109,17 @@ 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);
if(!isset($this->_e[$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,15 +150,15 @@ 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);
if(!isset($this->_e[$name]))
$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,15 +546,15 @@ 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))
{
// an array: 0 - object, 1 - method name
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)));
}
@@ -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];
}
@@ -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);
}
}
@@ -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'])
@@ -82,15 +82,15 @@ 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);
}
else
return null;
}
- else if(($content=@file_get_contents($stateFile))!==false)
+ elseif(($content=@file_get_contents($stateFile))!==false)
return unserialize($content);
else
return null;
@@ -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;
@@ -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);
@@ -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";
@@ -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
{
@@ -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())
@@ -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;
@@ -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.'));
}
Oops, something went wrong.

0 comments on commit 99e90d8

Please sign in to comment.