@@ -71,14 +71,12 @@ discard block |
||
| 71 | 71 | $configFile->loadFromFile($this->_paramFile); |
| 72 | 72 | $cache->set($cacheKey,$configFile,0,new TFileCacheDependency($this->_paramFile)); |
| 73 | 73 | } |
| 74 | - } |
|
| 75 | - else |
|
| 74 | + } else |
|
| 76 | 75 | { |
| 77 | 76 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
| 78 | 77 | { |
| 79 | 78 | $configFile = include $this->_paramFile; |
| 80 | - } |
|
| 81 | - else |
|
| 79 | + } else |
|
| 82 | 80 | { |
| 83 | 81 | $configFile=new TXmlDocument; |
| 84 | 82 | $configFile->loadFromFile($this->_paramFile); |
@@ -105,14 +103,12 @@ discard block |
||
| 105 | 103 | { |
| 106 | 104 | $properties = isset($parameter['properties'])?$parameter['properties']:array(); |
| 107 | 105 | $parameters[$id]=array($parameter['class'],$properties); |
| 108 | - } |
|
| 109 | - else |
|
| 106 | + } else |
|
| 110 | 107 | { |
| 111 | 108 | $parameters[$id] = $parameter; |
| 112 | 109 | } |
| 113 | 110 | } |
| 114 | - } |
|
| 115 | - else if($config instanceof TXmlElement) |
|
| 111 | + } else if($config instanceof TXmlElement) |
|
| 116 | 112 | { |
| 117 | 113 | foreach($config->getElementsByTagName('parameter') as $node) |
| 118 | 114 | { |
@@ -125,8 +121,7 @@ discard block |
||
| 125 | 121 | $parameters[$id]=$node; |
| 126 | 122 | else |
| 127 | 123 | $parameters[$id]=$value; |
| 128 | - } |
|
| 129 | - else |
|
| 124 | + } else |
|
| 130 | 125 | $parameters[$id]=array($type,$properties->toArray()); |
| 131 | 126 | } |
| 132 | 127 | } |
@@ -140,8 +135,7 @@ discard block |
||
| 140 | 135 | foreach($parameter[1] as $name=>$value) |
| 141 | 136 | $component->setSubProperty($name,$value); |
| 142 | 137 | $appParams->add($id,$component); |
| 143 | - } |
|
| 144 | - else |
|
| 138 | + } else |
|
| 145 | 139 | $appParams->add($id,$parameter); |
| 146 | 140 | } |
| 147 | 141 | } |
@@ -155,8 +155,9 @@ discard block |
||
| 155 | 155 | $this->_temp_tarname = ''; |
| 156 | 156 | return false; |
| 157 | 157 | } |
| 158 | - while ($v_data = @fread($v_file_from, 1024)) |
|
| 159 | - @fwrite($v_file_to, $v_data); |
|
| 158 | + while ($v_data = @fread($v_file_from, 1024)) { |
|
| 159 | + @fwrite($v_file_to, $v_data); |
|
| 160 | + } |
|
| 160 | 161 | @fclose($v_file_from); |
| 161 | 162 | @fclose($v_file_to); |
| 162 | 163 | } |
@@ -410,8 +411,9 @@ discard block |
||
| 410 | 411 | $v_header['filename'] = substr($v_header['filename'], |
| 411 | 412 | $p_remove_path_size); |
| 412 | 413 | if (($p_path != './') && ($p_path != '/')) { |
| 413 | - while (substr($p_path, -1) == '/') |
|
| 414 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
| 414 | + while (substr($p_path, -1) == '/') { |
|
| 415 | + $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
| 416 | + } |
|
| 415 | 417 | |
| 416 | 418 | if (substr($v_header['filename'], 0, 1) == '/') |
| 417 | 419 | $v_header['filename'] = $p_path.$v_header['filename']; |
@@ -203,11 +203,9 @@ discard block |
||
| 203 | 203 | $info['NumericPrecision'] = intval($matches[1]); |
| 204 | 204 | if(count($matches) > 2) |
| 205 | 205 | $info['NumericScale'] = intval($matches[2]); |
| 206 | - } |
|
| 207 | - else |
|
| 206 | + } else |
|
| 208 | 207 | $info['ColumnSize'] = intval($matches[1]); |
| 209 | - } |
|
| 210 | - else |
|
| 208 | + } else |
|
| 211 | 209 | $info['DbType'] = $col['type']; |
| 212 | 210 | $tableInfo->Columns[$columnId] = new TOracleTableColumn($info); |
| 213 | 211 | } |
@@ -349,8 +347,7 @@ discard block |
||
| 349 | 347 | SELECT table_name, '{$schema}' as table_schema FROM user_tables |
| 350 | 348 | EOD; |
| 351 | 349 | $command=$this->getDbConnection()->createCommand($sql); |
| 352 | - } |
|
| 353 | - else |
|
| 350 | + } else |
|
| 354 | 351 | { |
| 355 | 352 | $sql=<<<EOD |
| 356 | 353 | SELECT object_name as table_name, owner as table_schema FROM all_objects |
@@ -154,8 +154,7 @@ discard block |
||
| 154 | 154 | $info['NumericPrecision'] = intval($pscale[1]); |
| 155 | 155 | if(count($pscale) > 2) |
| 156 | 156 | $info['NumericScale'] = intval($pscale[2]); |
| 157 | - } |
|
| 158 | - else |
|
| 157 | + } else |
|
| 159 | 158 | $info['ColumnSize'] = intval($pscale[1]); |
| 160 | 159 | } |
| 161 | 160 | } |
@@ -254,8 +253,7 @@ discard block |
||
| 254 | 253 | try |
| 255 | 254 | { |
| 256 | 255 | return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW'; |
| 257 | - } |
|
| 258 | - catch(TDbException $e) |
|
| 256 | + } catch(TDbException $e) |
|
| 259 | 257 | { |
| 260 | 258 | $table = $schemaName===null?$tableName:$schemaName.'.'.$tableName; |
| 261 | 259 | throw new TDbException('dbcommon_invalid_table_name',$table,$e->getMessage()); |
@@ -425,14 +425,12 @@ discard block |
||
| 425 | 425 | $this->_recordState = self::STATE_LOADED; |
| 426 | 426 | return true; |
| 427 | 427 | } |
| 428 | - } |
|
| 429 | - else if($this->_recordState===self::STATE_LOADED) |
|
| 428 | + } else if($this->_recordState===self::STATE_LOADED) |
|
| 430 | 429 | { |
| 431 | 430 | $this->onUpdate($param); |
| 432 | 431 | if($param->getIsValid() && $gateway->update($this)) |
| 433 | 432 | return true; |
| 434 | - } |
|
| 435 | - else |
|
| 433 | + } else |
|
| 436 | 434 | throw new TActiveRecordException('ar_save_invalid', get_class($this)); |
| 437 | 435 | |
| 438 | 436 | return false; |
@@ -455,8 +453,7 @@ discard block |
||
| 455 | 453 | $this->_recordState=self::STATE_DELETED; |
| 456 | 454 | return true; |
| 457 | 455 | } |
| 458 | - } |
|
| 459 | - else |
|
| 456 | + } else |
|
| 460 | 457 | throw new TActiveRecordException('ar_delete_invalid', get_class($this)); |
| 461 | 458 | |
| 462 | 459 | return false; |
@@ -723,8 +720,7 @@ discard block |
||
| 723 | 720 | { |
| 724 | 721 | $criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1)); |
| 725 | 722 | return $context->getRelationHandler($criteria); |
| 726 | - } |
|
| 727 | - else |
|
| 723 | + } else |
|
| 728 | 724 | return null; |
| 729 | 725 | } |
| 730 | 726 | |
@@ -743,8 +739,7 @@ discard block |
||
| 743 | 739 | { |
| 744 | 740 | list($property, $relation) = $definition; |
| 745 | 741 | return new TActiveRecordRelationContext($this,$property,$relation); |
| 746 | - } |
|
| 747 | - else |
|
| 742 | + } else |
|
| 748 | 743 | return null; |
| 749 | 744 | } |
| 750 | 745 | |
@@ -827,8 +822,7 @@ discard block |
||
| 827 | 822 | { |
| 828 | 823 | $property= $method[4]==='_' ? substr($method,5) : substr($method,4); |
| 829 | 824 | return $this->getRelationHandler($property, $args); |
| 830 | - } |
|
| 831 | - else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 825 | + } else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 832 | 826 | $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
| 833 | 827 | else if(strncasecmp($method,'findallby',9)===0) |
| 834 | 828 | $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
@@ -894,8 +888,7 @@ discard block |
||
| 894 | 888 | { |
| 895 | 889 | $useArgs = !is_array($parameters) && is_array($args); |
| 896 | 890 | return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters); |
| 897 | - } |
|
| 898 | - else if($criteria instanceof TSqlCriteria) |
|
| 891 | + } else if($criteria instanceof TSqlCriteria) |
|
| 899 | 892 | return $criteria; |
| 900 | 893 | else |
| 901 | 894 | return new TActiveRecordCriteria(); |
@@ -109,8 +109,7 @@ discard block |
||
| 109 | 109 | try |
| 110 | 110 | { |
| 111 | 111 | $this->_statement=$this->getConnection()->getPdoInstance()->prepare($this->getText()); |
| 112 | - } |
|
| 113 | - catch(Exception $e) |
|
| 112 | + } catch(Exception $e) |
|
| 114 | 113 | { |
| 115 | 114 | throw new TDbException('dbcommand_prepare_failed',$e->getMessage(),$this->getText()); |
| 116 | 115 | } |
@@ -186,11 +185,9 @@ discard block |
||
| 186 | 185 | { |
| 187 | 186 | $this->_statement->execute(); |
| 188 | 187 | return $this->_statement->rowCount(); |
| 189 | - } |
|
| 190 | - else |
|
| 188 | + } else |
|
| 191 | 189 | return $this->getConnection()->getPdoInstance()->exec($this->getText()); |
| 192 | - } |
|
| 193 | - catch(Exception $e) |
|
| 190 | + } catch(Exception $e) |
|
| 194 | 191 | { |
| 195 | 192 | throw new TDbException('dbcommand_execute_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 196 | 193 | } |
@@ -223,8 +220,7 @@ discard block |
||
| 223 | 220 | else |
| 224 | 221 | $this->_statement=$this->getConnection()->getPdoInstance()->query($this->getText()); |
| 225 | 222 | return new TDbDataReader($this); |
| 226 | - } |
|
| 227 | - catch(Exception $e) |
|
| 223 | + } catch(Exception $e) |
|
| 228 | 224 | { |
| 229 | 225 | throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 230 | 226 | } |
@@ -250,8 +246,7 @@ discard block |
||
| 250 | 246 | $result=$this->_statement->fetch($fetchAssociative ? PDO::FETCH_ASSOC : PDO::FETCH_NUM); |
| 251 | 247 | $this->_statement->closeCursor(); |
| 252 | 248 | return $result; |
| 253 | - } |
|
| 254 | - catch(Exception $e) |
|
| 249 | + } catch(Exception $e) |
|
| 255 | 250 | { |
| 256 | 251 | throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 257 | 252 | } |
@@ -279,8 +274,7 @@ discard block |
||
| 279 | 274 | return stream_get_contents($result); |
| 280 | 275 | else |
| 281 | 276 | return $result; |
| 282 | - } |
|
| 283 | - catch(Exception $e) |
|
| 277 | + } catch(Exception $e) |
|
| 284 | 278 | { |
| 285 | 279 | throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 286 | 280 | } |
@@ -181,22 +181,18 @@ discard block |
||
| 181 | 181 | $this->_currentPageIndex=$pageIndex; |
| 182 | 182 | $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); |
| 183 | 183 | return $pageIndex; |
| 184 | - } |
|
| 185 | - else |
|
| 184 | + } else |
|
| 186 | 185 | return false; |
| 187 | - } |
|
| 188 | - else |
|
| 186 | + } else |
|
| 189 | 187 | return false; |
| 190 | - } |
|
| 191 | - else |
|
| 188 | + } else |
|
| 192 | 189 | { |
| 193 | 190 | if($pageIndex>=0 && $pageIndex<$this->getPageCount()) |
| 194 | 191 | { |
| 195 | 192 | $this->_currentPageIndex=$pageIndex; |
| 196 | 193 | $this->onPageIndexChanged(null); |
| 197 | 194 | return $pageIndex; |
| 198 | - } |
|
| 199 | - else |
|
| 195 | + } else |
|
| 200 | 196 | return false; |
| 201 | 197 | } |
| 202 | 198 | } |
@@ -248,8 +244,7 @@ discard block |
||
| 248 | 244 | return (int)(($this->_virtualCount+$this->_pageSize-1)/$this->_pageSize); |
| 249 | 245 | else |
| 250 | 246 | return -1; |
| 251 | - } |
|
| 252 | - else |
|
| 247 | + } else |
|
| 253 | 248 | return (int)((parent::getCount()+$this->_pageSize-1)/$this->_pageSize); |
| 254 | 249 | } |
| 255 | 250 | |
@@ -163,11 +163,9 @@ discard block |
||
| 163 | 163 | $value=$this->_d[$key]; |
| 164 | 164 | unset($this->_d[$key]); |
| 165 | 165 | return $value; |
| 166 | - } |
|
| 167 | - else |
|
| 166 | + } else |
|
| 168 | 167 | return null; |
| 169 | - } |
|
| 170 | - else |
|
| 168 | + } else |
|
| 171 | 169 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 172 | 170 | } |
| 173 | 171 | |
@@ -211,8 +209,7 @@ discard block |
||
| 211 | 209 | $this->clear(); |
| 212 | 210 | foreach($data as $key=>$value) |
| 213 | 211 | $this->add($key,$value); |
| 214 | - } |
|
| 215 | - else if($data!==null) |
|
| 212 | + } else if($data!==null) |
|
| 216 | 213 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 217 | 214 | } |
| 218 | 215 | |
@@ -228,8 +225,7 @@ discard block |
||
| 228 | 225 | { |
| 229 | 226 | foreach($data as $key=>$value) |
| 230 | 227 | $this->add($key,$value); |
| 231 | - } |
|
| 232 | - else if($data!==null) |
|
| 228 | + } else if($data!==null) |
|
| 233 | 229 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 234 | 230 | } |
| 235 | 231 | |
@@ -155,11 +155,9 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | array_splice($this->_d,$index,0,array($item)); |
| 157 | 157 | $this->_c++; |
| 158 | - } |
|
| 159 | - else |
|
| 158 | + } else |
|
| 160 | 159 | throw new TInvalidDataValueException('list_index_invalid',$index); |
| 161 | - } |
|
| 162 | - else |
|
| 160 | + } else |
|
| 163 | 161 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 164 | 162 | } |
| 165 | 163 | |
@@ -180,11 +178,9 @@ discard block |
||
| 180 | 178 | { |
| 181 | 179 | $this->removeAt($index); |
| 182 | 180 | return $index; |
| 183 | - } |
|
| 184 | - else |
|
| 181 | + } else |
|
| 185 | 182 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 186 | - } |
|
| 187 | - else |
|
| 183 | + } else |
|
| 188 | 184 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 189 | 185 | } |
| 190 | 186 | |
@@ -210,11 +206,9 @@ discard block |
||
| 210 | 206 | array_splice($this->_d,$index,1); |
| 211 | 207 | return $item; |
| 212 | 208 | } |
| 213 | - } |
|
| 214 | - else |
|
| 209 | + } else |
|
| 215 | 210 | throw new TInvalidDataValueException('list_index_invalid',$index); |
| 216 | - } |
|
| 217 | - else |
|
| 211 | + } else |
|
| 218 | 212 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 219 | 213 | } |
| 220 | 214 | |
@@ -268,8 +262,7 @@ discard block |
||
| 268 | 262 | $this->insertAt($index, $item); |
| 269 | 263 | |
| 270 | 264 | return $index; |
| 271 | - } |
|
| 272 | - else |
|
| 265 | + } else |
|
| 273 | 266 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 274 | 267 | } |
| 275 | 268 | |
@@ -292,8 +285,7 @@ discard block |
||
| 292 | 285 | $this->insertAt($index + 1, $item); |
| 293 | 286 | |
| 294 | 287 | return $index + 1; |
| 295 | - } |
|
| 296 | - else |
|
| 288 | + } else |
|
| 297 | 289 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 298 | 290 | } |
| 299 | 291 | |
@@ -319,8 +311,7 @@ discard block |
||
| 319 | 311 | $this->clear(); |
| 320 | 312 | foreach($data as $item) |
| 321 | 313 | $this->add($item); |
| 322 | - } |
|
| 323 | - else if($data!==null) |
|
| 314 | + } else if($data!==null) |
|
| 324 | 315 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
| 325 | 316 | } |
| 326 | 317 | |
@@ -336,8 +327,7 @@ discard block |
||
| 336 | 327 | { |
| 337 | 328 | foreach($data as $item) |
| 338 | 329 | $this->add($item); |
| 339 | - } |
|
| 340 | - else if($data!==null) |
|
| 330 | + } else if($data!==null) |
|
| 341 | 331 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
| 342 | 332 | } |
| 343 | 333 | |