@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord) |
81 | 81 | { |
82 | 82 | $this->collectForeignObjects($results); |
83 | - while($obj = array_pop($stack)) |
|
84 | - $obj->collectForeignObjects($results); |
|
85 | - } |
|
86 | - else if($results instanceof TActiveRecordRelation) |
|
83 | + while($obj = array_pop($stack)) { |
|
84 | + $obj->collectForeignObjects($results); |
|
85 | + } |
|
86 | + } else if($results instanceof TActiveRecordRelation) |
|
87 | 87 | $stack[] = $this; //call it later |
88 | 88 | else if($results === null || !$validArray) |
89 | 89 | $stack = array(); |
@@ -233,8 +233,7 @@ discard block |
||
233 | 233 | { |
234 | 234 | for($i=0,$k=count($results);$i<$k;$i++) |
235 | 235 | $this->setObjectProperty($results[$i], $properties, $collections); |
236 | - } |
|
237 | - else |
|
236 | + } else |
|
238 | 237 | $this->setObjectProperty($results, $properties, $collections); |
239 | 238 | } |
240 | 239 |
@@ -158,8 +158,7 @@ |
||
158 | 158 | $e->setAttribute('maxOccurs','unbounded'); |
159 | 159 | $sequence->appendChild($e); |
160 | 160 | $complexType->appendChild($sequence); |
161 | - } |
|
162 | - else |
|
161 | + } else |
|
163 | 162 | { |
164 | 163 | $all = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:all'); |
165 | 164 | foreach($elements as $elem) |
@@ -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 | } |
@@ -189,8 +189,7 @@ discard block |
||
189 | 189 | return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
190 | 190 | else |
191 | 191 | return false; |
192 | - } |
|
193 | - else |
|
192 | + } else |
|
194 | 193 | return false; |
195 | 194 | } |
196 | 195 | |
@@ -211,8 +210,7 @@ discard block |
||
211 | 210 | $this->_errorCode=$_FILES[$key]['error']; |
212 | 211 | $this->_localName=$_FILES[$key]['tmp_name']; |
213 | 212 | return $this->_dataChanged=true; |
214 | - } |
|
215 | - else |
|
213 | + } else |
|
216 | 214 | return false; |
217 | 215 | } |
218 | 216 |
@@ -124,8 +124,7 @@ |
||
124 | 124 | if (!@mysql_select_db($dsninfo['database'], $conn)) |
125 | 125 | throw new Exception('Error in connecting database, dns:'. |
126 | 126 | $dsninfo); |
127 | - } |
|
128 | - else |
|
127 | + } else |
|
129 | 128 | throw new Exception('Please provide a database for message'. |
130 | 129 | ' translation.'); |
131 | 130 | return $conn; |
@@ -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 |
@@ -81,8 +81,7 @@ |
||
81 | 81 | $this->_d[]=$item; |
82 | 82 | ++$this->_c; |
83 | 83 | } |
84 | - } |
|
85 | - else if($data!==null) |
|
84 | + } else if($data!==null) |
|
86 | 85 | throw new TInvalidDataTypeException('queue_data_not_iterable'); |
87 | 86 | } |
88 | 87 |