@@ -433,8 +433,7 @@ discard block |
||
433 | 433 | } |
434 | 434 | $control->setData($text); |
435 | 435 | } |
436 | - } |
|
437 | - elseif($this->getAllowSorting()) |
|
436 | + } elseif($this->getAllowSorting()) |
|
438 | 437 | { |
439 | 438 | $sortExpression = $this->getSortExpression(); |
440 | 439 | if(($url = $this->getHeaderImageUrl()) !== '') |
@@ -447,8 +446,7 @@ discard block |
||
447 | 446 | $button->setAlternateText($text); |
448 | 447 | $button->setCausesValidation(false); |
449 | 448 | $cell->getControls()->add($button); |
450 | - } |
|
451 | - elseif($text !== '') |
|
449 | + } elseif($text !== '') |
|
452 | 450 | { |
453 | 451 | $button = new TLinkButton; |
454 | 452 | $button->setText($text); |
@@ -456,11 +454,9 @@ discard block |
||
456 | 454 | $button->setCommandParameter($sortExpression); |
457 | 455 | $button->setCausesValidation(false); |
458 | 456 | $cell->getControls()->add($button); |
459 | - } |
|
460 | - else |
|
457 | + } else |
|
461 | 458 | $cell->setText(' '); |
462 | - } |
|
463 | - else |
|
459 | + } else |
|
464 | 460 | { |
465 | 461 | if(($url = $this->getHeaderImageUrl()) !== '') |
466 | 462 | { |
@@ -469,8 +465,7 @@ discard block |
||
469 | 465 | if($text !== '') |
470 | 466 | $image->setAlternateText($text); |
471 | 467 | $cell->getControls()->add($image); |
472 | - } |
|
473 | - elseif($text !== '') |
|
468 | + } elseif($text !== '') |
|
474 | 469 | $cell->setText($text); |
475 | 470 | else |
476 | 471 | $cell->setText(' '); |
@@ -504,8 +499,7 @@ discard block |
||
504 | 499 | } |
505 | 500 | $control->setData($text); |
506 | 501 | } |
507 | - } |
|
508 | - elseif($text !== '') |
|
502 | + } elseif($text !== '') |
|
509 | 503 | $cell->setText($text); |
510 | 504 | else |
511 | 505 | $cell->setText(' '); |
@@ -535,13 +529,11 @@ discard block |
||
535 | 529 | if(eval("\$result=$expression;") === false) |
536 | 530 | throw new Exception(''); |
537 | 531 | return $result; |
538 | - } |
|
539 | - catch(Exception $e) |
|
532 | + } catch(Exception $e) |
|
540 | 533 | { |
541 | 534 | throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); |
542 | 535 | } |
543 | - } |
|
544 | - else |
|
536 | + } else |
|
545 | 537 | return sprintf($formatString, $value); |
546 | 538 | } |
547 | 539 | } |
548 | 540 | \ No newline at end of file |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | protected function getViewState($key, $defaultValue = null) |
293 | 293 | { |
294 | - return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue; |
|
294 | + return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | throw new Exception(''); |
537 | 537 | return $result; |
538 | 538 | } |
539 | - catch(Exception $e) |
|
539 | + catch (Exception $e) |
|
540 | 540 | { |
541 | 541 | throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); |
542 | 542 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
117 | 117 | $this->renderClientControlScript($writer); |
118 | - } |
|
119 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
118 | + } elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
120 | 119 | $writer->addAttribute('disabled', 'disabled'); |
121 | 120 | |
122 | 121 | parent::addAttributesToRender($writer); |
@@ -150,8 +149,7 @@ discard block |
||
150 | 149 | { |
151 | 150 | $group = $this->getValidationGroup(); |
152 | 151 | return $this->getPage()->getValidators($group)->getCount() > 0; |
153 | - } |
|
154 | - else |
|
152 | + } else |
|
155 | 153 | return false; |
156 | 154 | } |
157 | 155 |
@@ -287,8 +287,7 @@ discard block |
||
287 | 287 | { |
288 | 288 | $this->_requiresDataBinding = true; |
289 | 289 | $this->ensureDataBound(); |
290 | - } |
|
291 | - else |
|
290 | + } else |
|
292 | 291 | $this->_requiresDataBinding = $value; |
293 | 292 | } |
294 | 293 | |
@@ -351,8 +350,7 @@ discard block |
||
351 | 350 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
352 | 351 | } |
353 | 352 | $this->performDataBinding($ds); |
354 | - } |
|
355 | - else |
|
353 | + } else |
|
356 | 354 | { |
357 | 355 | $this->clearViewState('PageCount'); |
358 | 356 | $this->performDataBinding($data); |
@@ -381,8 +379,7 @@ discard block |
||
381 | 379 | if($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID()) |
382 | 380 | $view->attachEventHandler('OnDataSourceViewChanged', [$this,'dataSourceViewChanged']); |
383 | 381 | $this->_currentView = $view; |
384 | - } |
|
385 | - else |
|
382 | + } else |
|
386 | 383 | $this->_currentView = null; |
387 | 384 | $this->_currentViewValid = true; |
388 | 385 | } |
@@ -401,8 +398,7 @@ discard block |
||
401 | 398 | throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid); |
402 | 399 | else |
403 | 400 | $this->_currentDataSource = $dataSource; |
404 | - } |
|
405 | - elseif(($dataSource = $this->getDataSource()) !== null) |
|
401 | + } elseif(($dataSource = $this->getDataSource()) !== null) |
|
406 | 402 | $this->_currentDataSource = new TReadOnlyDataSource($dataSource, $this->getDataMember()); |
407 | 403 | else |
408 | 404 | $this->_currentDataSource = null; |
@@ -483,14 +479,12 @@ discard block |
||
483 | 479 | $list->add([$value,is_string($key)?$key:$value]); |
484 | 480 | } |
485 | 481 | return $list; |
486 | - } |
|
487 | - elseif(is_array($value)) |
|
482 | + } elseif(is_array($value)) |
|
488 | 483 | return new TMap($value); |
489 | 484 | elseif($value instanceof TDbDataReader) { |
490 | 485 | // read array from TDbDataReader since it's forward-only stream and can only be traversed once |
491 | 486 | return $value->readAll(); |
492 | - } |
|
493 | - elseif(($value instanceof \Traversable) || $value === null) |
|
487 | + } elseif(($value instanceof \Traversable) || $value === null) |
|
494 | 488 | return $value; |
495 | 489 | else |
496 | 490 | throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this)); |
@@ -373,13 +373,13 @@ discard block |
||
373 | 373 | if(!$this->_currentViewValid) |
374 | 374 | { |
375 | 375 | if($this->_currentView && $this->_currentViewIsFromDataSourceID) |
376 | - $this->_currentView->detachEventHandler('DataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
376 | + $this->_currentView->detachEventHandler('DataSourceViewChanged', [$this, 'dataSourceViewChanged']); |
|
377 | 377 | if(($dataSource = $this->determineDataSource()) !== null) |
378 | 378 | { |
379 | 379 | if(($view = $dataSource->getView($this->getDataMember())) === null) |
380 | 380 | throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember()); |
381 | 381 | if($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID()) |
382 | - $view->attachEventHandler('OnDataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
382 | + $view->attachEventHandler('OnDataSourceViewChanged', [$this, 'dataSourceViewChanged']); |
|
383 | 383 | $this->_currentView = $view; |
384 | 384 | } |
385 | 385 | else |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | { |
435 | 435 | parent::onInit($param); |
436 | 436 | $page = $this->getPage(); |
437 | - $page->attachEventHandler('OnPreLoad', [$this,'pagePreLoad']); |
|
437 | + $page->attachEventHandler('OnPreLoad', [$this, 'pagePreLoad']); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | if(is_array($value)) |
481 | 481 | $list->add($value); |
482 | 482 | else |
483 | - $list->add([$value,is_string($key)?$key:$value]); |
|
483 | + $list->add([$value, is_string($key) ? $key : $value]); |
|
484 | 484 | } |
485 | 485 | return $list; |
486 | 486 | } |
@@ -142,8 +142,7 @@ |
||
142 | 142 | return file_put_contents($fileName, file_get_contents($this->_localName)) !== false; |
143 | 143 | else |
144 | 144 | return false; |
145 | - } |
|
146 | - else |
|
145 | + } else |
|
147 | 146 | return false; |
148 | 147 | } |
149 | 148 |
@@ -306,8 +306,7 @@ discard block |
||
306 | 306 | { |
307 | 307 | if($index === 0 && $currentSection === TTableRowSection::Header) |
308 | 308 | $writer->renderBeginTag('thead'); |
309 | - } |
|
310 | - else |
|
309 | + } else |
|
311 | 310 | { |
312 | 311 | if($currentSection === TTableRowSection::Header) |
313 | 312 | { |
@@ -318,8 +317,7 @@ discard block |
||
318 | 317 | else |
319 | 318 | $writer->renderBeginTag('tfoot'); |
320 | 319 | $currentSection = $section; |
321 | - } |
|
322 | - elseif($currentSection === TTableRowSection::Body) |
|
320 | + } elseif($currentSection === TTableRowSection::Body) |
|
323 | 321 | { |
324 | 322 | $writer->renderEndTag(); |
325 | 323 | if($section === TTableRowSection::Footer) |
@@ -327,16 +325,14 @@ discard block |
||
327 | 325 | else |
328 | 326 | throw new TConfigurationException('table_tablesection_outoforder'); |
329 | 327 | $currentSection = $section; |
330 | - } |
|
331 | - else // Footer |
|
328 | + } else // Footer |
|
332 | 329 | throw new TConfigurationException('table_tablesection_outoforder'); |
333 | 330 | } |
334 | 331 | $row->renderControl($writer); |
335 | 332 | $writer->writeLine(); |
336 | 333 | } |
337 | 334 | $writer->renderEndTag(); |
338 | - } |
|
339 | - else |
|
335 | + } else |
|
340 | 336 | { |
341 | 337 | $writer->writeLine(); |
342 | 338 | foreach($this->getControls() as $row) |
@@ -110,7 +110,7 @@ |
||
110 | 110 | if(($border = $this->getBorderWidth()) === '') |
111 | 111 | $border = 1; |
112 | 112 | else |
113 | - $border = (int)$border; |
|
113 | + $border = (int) $border; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | $writer->addAttribute('border', "$border"); |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | $writer->addAttribute('cols', "$cols"); |
122 | 122 | if(!$this->getWrap()) |
123 | 123 | $writer->addAttribute('wrap', 'off'); |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | switch($textMode) |
128 | 127 | { |
@@ -268,8 +267,7 @@ discard block |
||
268 | 267 | { |
269 | 268 | $this->setText($value); |
270 | 269 | return $this->_dataChanged = true; |
271 | - } |
|
272 | - else |
|
270 | + } else |
|
273 | 271 | return false; |
274 | 272 | } |
275 | 273 |
@@ -81,7 +81,7 @@ |
||
81 | 81 | */ |
82 | 82 | protected function getTagName() |
83 | 83 | { |
84 | - return ($this->getTextMode() === 'MultiLine')?'textarea':'input'; |
|
84 | + return ($this->getTextMode() === 'MultiLine') ? 'textarea' : 'input'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -104,8 +104,7 @@ |
||
104 | 104 | $this->_query = isset($ret['query'])?$ret['query']:''; |
105 | 105 | $this->_fragment = isset($ret['fragment'])?$ret['fragment']:''; |
106 | 106 | $this->_uri = $uri; |
107 | - } |
|
108 | - else |
|
107 | + } else |
|
109 | 108 | { |
110 | 109 | throw new TInvalidDataValueException('uri_format_invalid', $uri); |
111 | 110 | } |
@@ -95,14 +95,14 @@ |
||
95 | 95 | if(($ret = @parse_url($uri)) !== false) |
96 | 96 | { |
97 | 97 | // decoding??? |
98 | - $this->_scheme = isset($ret['scheme'])?$ret['scheme']:''; |
|
99 | - $this->_host = isset($ret['host'])?$ret['host']:''; |
|
100 | - $this->_port = isset($ret['port'])?$ret['port']:''; |
|
101 | - $this->_user = isset($ret['user'])?$ret['user']:''; |
|
102 | - $this->_pass = isset($ret['pass'])?$ret['pass']:''; |
|
103 | - $this->_path = isset($ret['path'])?$ret['path']:''; |
|
104 | - $this->_query = isset($ret['query'])?$ret['query']:''; |
|
105 | - $this->_fragment = isset($ret['fragment'])?$ret['fragment']:''; |
|
98 | + $this->_scheme = isset($ret['scheme']) ? $ret['scheme'] : ''; |
|
99 | + $this->_host = isset($ret['host']) ? $ret['host'] : ''; |
|
100 | + $this->_port = isset($ret['port']) ? $ret['port'] : ''; |
|
101 | + $this->_user = isset($ret['user']) ? $ret['user'] : ''; |
|
102 | + $this->_pass = isset($ret['pass']) ? $ret['pass'] : ''; |
|
103 | + $this->_path = isset($ret['path']) ? $ret['path'] : ''; |
|
104 | + $this->_query = isset($ret['query']) ? $ret['query'] : ''; |
|
105 | + $this->_fragment = isset($ret['fragment']) ? $ret['fragment'] : ''; |
|
106 | 106 | $this->_uri = $uri; |
107 | 107 | } |
108 | 108 | else |
@@ -63,8 +63,7 @@ |
||
63 | 63 | if($item->getParent() !== null) |
64 | 64 | $item->getParent()->getElements()->remove($item); |
65 | 65 | $item->setParent($this->_o); |
66 | - } |
|
67 | - else |
|
66 | + } else |
|
68 | 67 | throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required'); |
69 | 68 | } |
70 | 69 |
@@ -136,12 +136,10 @@ discard block |
||
136 | 136 | { |
137 | 137 | $sub = preg_replace('/(^\')|(\'$)/', '', $pattern); |
138 | 138 | $tokens[$i] = str_replace('``````', '\'', $sub); |
139 | - } |
|
140 | - elseif($pattern == '``````') |
|
139 | + } elseif($pattern == '``````') |
|
141 | 140 | { |
142 | 141 | $tokens[$i] = '\''; |
143 | - } |
|
144 | - else |
|
142 | + } else |
|
145 | 143 | { |
146 | 144 | $function = $this->getFunctionName($pattern); |
147 | 145 | if($function != null) |
@@ -151,8 +149,7 @@ discard block |
||
151 | 149 | { |
152 | 150 | $rs = $this->$fName($date, $pattern); |
153 | 151 | $tokens[$i] = $rs; |
154 | - } |
|
155 | - else |
|
152 | + } else |
|
156 | 153 | throw new |
157 | 154 | Exception('function ' . $function . ' not found.'); |
158 | 155 | } |
@@ -287,8 +284,7 @@ discard block |
||
287 | 284 | if($char == null || $pattern{$i} == $char || $text) |
288 | 285 | { |
289 | 286 | $token .= $pattern{$i}; |
290 | - } |
|
291 | - else |
|
287 | + } else |
|
292 | 288 | { |
293 | 289 | $tokens[] = str_replace("", "'", $token); |
294 | 290 | $token = $pattern{$i}; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function format($time, $pattern = 'F', $charset = 'UTF-8') |
115 | 115 | { |
116 | - if (is_numeric($time)) //assumes unix epoch |
|
116 | + if(is_numeric($time)) //assumes unix epoch |
|
117 | 117 | $time = floatval($time); |
118 | 118 | elseif(is_string($time)) |
119 | 119 | $time = @strtotime($time); |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | throw new Exception('The pattern for AM/PM marker is "a".'); |
457 | 457 | |
458 | 458 | $hour = $date->format('G'); |
459 | - $ampm = (int)($hour / 12); |
|
459 | + $ampm = (int) ($hour / 12); |
|
460 | 460 | return $this->formatInfo->AMPMMarkers[$ampm]; |
461 | 461 | } |
462 | 462 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | */ |
558 | 558 | protected function getDayInMonth($date, $pattern = 'FF') |
559 | 559 | { |
560 | - switch ($pattern) { |
|
560 | + switch($pattern) { |
|
561 | 561 | case 'F': |
562 | 562 | return $date->format('j'); |
563 | 563 | case 'FF': |