@@ -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': |
@@ -203,16 +203,14 @@ discard block |
||
203 | 203 | $integer = $groupSeparator . $integer; |
204 | 204 | $count++; |
205 | 205 | } |
206 | - } |
|
207 | - elseif($multiGroup && $count >= 1) |
|
206 | + } elseif($multiGroup && $count >= 1) |
|
208 | 207 | { |
209 | 208 | if($i != 0 && ($i - $groupSize[0]) % $groupSize[1] == 0) |
210 | 209 | { |
211 | 210 | $integer = $groupSeparator . $integer; |
212 | 211 | $count++; |
213 | 212 | } |
214 | - } |
|
215 | - else |
|
213 | + } else |
|
216 | 214 | { |
217 | 215 | if($i != 0 && $i % $groupSize[0] == 0) |
218 | 216 | { |
@@ -223,8 +221,7 @@ discard block |
||
223 | 221 | |
224 | 222 | $integer = $char . $integer; |
225 | 223 | } |
226 | - } |
|
227 | - else |
|
224 | + } else |
|
228 | 225 | $integer = $string; |
229 | 226 | |
230 | 227 | return $integer; |
@@ -250,27 +247,23 @@ discard block |
||
250 | 247 | if($decimalDigits == -1) |
251 | 248 | { |
252 | 249 | $decimal = substr($string, $dp + 1); |
253 | - } |
|
254 | - elseif(is_int($decimalDigits)) |
|
250 | + } elseif(is_int($decimalDigits)) |
|
255 | 251 | { |
256 | 252 | $float = round((float)$string, $decimalDigits); |
257 | 253 | if(strpos((string)$float, '.') === false) |
258 | 254 | { |
259 | 255 | $decimal = str_pad($decimal, $decimalDigits, '0'); |
260 | - } |
|
261 | - else |
|
256 | + } else |
|
262 | 257 | { |
263 | 258 | $decimal = substr($float, strpos($float, '.') + 1); |
264 | 259 | if(strlen($decimal) < $decimalDigits) |
265 | 260 | $decimal = str_pad($decimal, $decimalDigits, '0'); |
266 | 261 | } |
267 | - } |
|
268 | - else |
|
262 | + } else |
|
269 | 263 | return $decimal; |
270 | 264 | |
271 | 265 | return $decimalSeparator . $decimal; |
272 | - } |
|
273 | - elseif ($decimalDigits > 0) |
|
266 | + } elseif ($decimalDigits > 0) |
|
274 | 267 | return $decimalSeparator . str_pad($decimal, $decimalDigits, '0'); |
275 | 268 | |
276 | 269 | return $decimal; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if(strtolower($pattern) == 'p') |
124 | 124 | $number = $number * 100; |
125 | 125 | |
126 | - $string = (string)$number; |
|
126 | + $string = (string) $number; |
|
127 | 127 | |
128 | 128 | $decimal = $this->formatDecimal($string); |
129 | 129 | $integer = $this->formatInteger(abs($number)); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | elseif($number < 0) |
140 | 140 | $suffix = $this->formatInfo->NegativePattern; |
141 | 141 | else |
142 | - $suffix = ["",""]; |
|
142 | + $suffix = ["", ""]; |
|
143 | 143 | |
144 | 144 | //append and prepend suffix |
145 | 145 | $result = $suffix[0] . $result . $suffix[1]; |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | */ |
165 | 165 | protected function formatInteger($string) |
166 | 166 | { |
167 | - $string = (string)$string; |
|
167 | + $string = (string) $string; |
|
168 | 168 | |
169 | 169 | $decimalDigits = $this->formatInfo->DecimalDigits; |
170 | 170 | //if not decimal digits, assume 0 decimal points. |
171 | 171 | if(is_int($decimalDigits) && $decimalDigits > 0) |
172 | - $string = (string)round(floatval($string), $decimalDigits); |
|
172 | + $string = (string) round(floatval($string), $decimalDigits); |
|
173 | 173 | $dp = strpos($string, '.'); |
174 | 174 | if(is_int($dp)) |
175 | 175 | $string = substr($string, 0, $dp); |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | } |
254 | 254 | elseif(is_int($decimalDigits)) |
255 | 255 | { |
256 | - $float = round((float)$string, $decimalDigits); |
|
257 | - if(strpos((string)$float, '.') === false) |
|
256 | + $float = round((float) $string, $decimalDigits); |
|
257 | + if(strpos((string) $float, '.') === false) |
|
258 | 258 | { |
259 | 259 | $decimal = str_pad($decimal, $decimalDigits, '0'); |
260 | 260 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | return $decimalSeparator . $decimal; |
272 | 272 | } |
273 | - elseif ($decimalDigits > 0) |
|
273 | + elseif($decimalDigits > 0) |
|
274 | 274 | return $decimalSeparator . str_pad($decimal, $decimalDigits, '0'); |
275 | 275 | |
276 | 276 | return $decimal; |