@@ -109,7 +109,7 @@ |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * @return TControl|null control to be validated. Null if no control is found. |
|
112 | + * @return \Prado\Web\UI\TControl|null control to be validated. Null if no control is found. |
|
113 | 113 | */ |
114 | 114 | public function getValidationTarget() |
115 | 115 | { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
289 | - * @param ITemplate $value the template for repeater items |
|
289 | + * @param \Prado\Web\UI\TTemplate $value the template for repeater items |
|
290 | 290 | * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null. |
291 | 291 | */ |
292 | 292 | public function setItemTemplate($value) |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * This method invokes {@link createItem} to create a new repeater item. |
464 | 464 | * @param int $itemIndex zero-based item index. |
465 | 465 | * @param TListItemType $itemType item type |
466 | - * @return TControl the created item, null if item is not created |
|
466 | + * @return \Prado\TComponent|null the created item, null if item is not created |
|
467 | 467 | */ |
468 | 468 | private function createItemInternal($itemIndex, $itemType) |
469 | 469 | { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * @param int $itemIndex zero-based item index. |
484 | 484 | * @param TListItemType $itemType item type |
485 | 485 | * @param mixed $dataItem data to be associated with the item |
486 | - * @return TControl the created item, null if item is not created |
|
486 | + * @return \Prado\TComponent|null the created item, null if item is not created |
|
487 | 487 | */ |
488 | 488 | private function createItemWithDataInternal($itemIndex, $itemType, $dataItem) |
489 | 489 | { |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * Creates a repeater item instance based on the item type and index. |
507 | 507 | * @param int $itemIndex zero-based item index |
508 | 508 | * @param TListItemType $itemType item type |
509 | - * @return TControl created repeater item |
|
509 | + * @return null|\Prado\TComponent created repeater item |
|
510 | 510 | */ |
511 | 511 | protected function createItem($itemIndex, $itemType) |
512 | 512 | { |
@@ -78,15 +78,15 @@ |
||
78 | 78 | $data['file'] = $this->hidePrivatePathParts($exception->getFile()); |
79 | 79 | $data['line'] = $exception->getLine(); |
80 | 80 | $data['trace'] = $exception->getTrace(); |
81 | - foreach($data['trace'] as $k => $v) |
|
81 | + foreach ($data['trace'] as $k => $v) |
|
82 | 82 | { |
83 | - if(isset($v['file'])) |
|
83 | + if (isset($v['file'])) |
|
84 | 84 | $data['trace'][$k]['file'] = $this->hidePrivatePathParts($v['file']); |
85 | 85 | |
86 | - if(isset($v['args'])) |
|
86 | + if (isset($v['args'])) |
|
87 | 87 | { |
88 | 88 | $argsout = []; |
89 | - foreach($v['args'] as $kArg => $vArg) |
|
89 | + foreach ($v['args'] as $kArg => $vArg) |
|
90 | 90 | { |
91 | 91 | $data['trace'][$k]['args'][$kArg] = TVarDumper::dump($vArg, 0, false); |
92 | 92 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $first = $logs[0][3]; |
42 | 42 | $even = true; |
43 | 43 | |
44 | - $blocks = [ [ 'info', 'Tot Time', 'Time ', '[Level] [Category] [Message]' ] ]; |
|
44 | + $blocks = [['info', 'Tot Time', 'Time ', '[Level] [Category] [Message]']]; |
|
45 | 45 | for ($i = 0, $n = count($logs); $i < $n; ++$i) { |
46 | 46 | if ($i < $n - 1) { |
47 | 47 | $timing['delta'] = $logs[$i + 1][3] - $logs[$i][3]; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | console.log ("[Tot Time] [Time ] [Level] [Category] [Message]"); |
85 | 85 | |
86 | -EOD; |
|
86 | +eod; |
|
87 | 87 | |
88 | 88 | return $string; |
89 | 89 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | </script> |
124 | 124 | |
125 | -EOD; |
|
125 | +eod; |
|
126 | 126 | |
127 | 127 | return $string; |
128 | 128 | } |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | */ |
191 | 191 | protected function getFormatter($culture, $datetype, $timetype) |
192 | 192 | { |
193 | - if(!isset(self::$formatters[$culture])) |
|
193 | + if (!isset(self::$formatters[$culture])) |
|
194 | 194 | self::$formatters[$culture] = []; |
195 | - if(!isset(self::$formatters[$culture][$datetype])) |
|
195 | + if (!isset(self::$formatters[$culture][$datetype])) |
|
196 | 196 | self::$formatters[$culture][$datetype] = []; |
197 | - if(!isset(self::$formatters[$culture][$datetype][$timetype])) |
|
197 | + if (!isset(self::$formatters[$culture][$datetype][$timetype])) |
|
198 | 198 | self::$formatters[$culture][$datetype][$timetype] = new \IntlDateFormatter($culture, $datetype, $timetype); |
199 | 199 | |
200 | 200 | return self::$formatters[$culture][$datetype][$timetype]; |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | $timetype = \IntlDateFormatter::LONG; |
231 | 231 | |
232 | 232 | // try the "date time" pattern format |
233 | - if(!empty($pattern)) |
|
233 | + if (!empty($pattern)) |
|
234 | 234 | { |
235 | 235 | $subs = explode(' ', $pattern, 2); |
236 | 236 | if (count($subs) == 2) { |
237 | 237 | $sub0 = $this->getPreset($subs[0]); |
238 | 238 | $sub1 = $this->getPreset($subs[1]); |
239 | 239 | |
240 | - if($sub0 !== null && $sub1 !== null) |
|
240 | + if ($sub0 !== null && $sub1 !== null) |
|
241 | 241 | { |
242 | 242 | $datetype = $sub0; |
243 | 243 | $timetype = $sub1; |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | // try the "date" pattern format |
250 | - if(!empty($pattern)) |
|
250 | + if (!empty($pattern)) |
|
251 | 251 | { |
252 | 252 | $sub = $this->getPreset($pattern); |
253 | - if($sub !== null) |
|
253 | + if ($sub !== null) |
|
254 | 254 | { |
255 | 255 | $datetype = $sub; |
256 | 256 | $timetype = $sub; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - if(empty($pattern)) |
|
261 | + if (empty($pattern)) |
|
262 | 262 | { |
263 | 263 | $formatter = $this->getFormatter($culture, $datetype, $timetype); |
264 | 264 | } else { |
@@ -79,7 +79,7 @@ |
||
79 | 79 | protected function getIsValidLocale($locale) |
80 | 80 | { |
81 | 81 | static $allLocales; |
82 | - if($allLocales === null) |
|
82 | + if ($allLocales === null) |
|
83 | 83 | { |
84 | 84 | $all = \ResourceBundle::getLocales(''); |
85 | 85 | } |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | */ |
196 | 196 | protected function getFormatter($culture, $type) |
197 | 197 | { |
198 | - if(!isset(self::$formatters[$culture])) |
|
198 | + if (!isset(self::$formatters[$culture])) |
|
199 | 199 | self::$formatters[$culture] = []; |
200 | - if(!isset(self::$formatters[$culture][$type])) |
|
200 | + if (!isset(self::$formatters[$culture][$type])) |
|
201 | 201 | self::$formatters[$culture][$type] = new \NumberFormatter($culture, $type); |
202 | 202 | |
203 | 203 | return self::$formatters[$culture][$type]; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $type = $this->getType(); |
222 | 222 | $pattern = $this->getPattern(); |
223 | 223 | |
224 | - if(empty($pattern)) |
|
224 | + if (empty($pattern)) |
|
225 | 225 | { |
226 | 226 | $formatter = $this->getFormatter($culture, $type); |
227 | 227 | } else { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $formatter->setPattern($pattern); |
230 | 230 | } |
231 | 231 | |
232 | - if($type === \NumberFormatter::CURRENCY) |
|
232 | + if ($type === \NumberFormatter::CURRENCY) |
|
233 | 233 | { |
234 | 234 | $result = $formatter->formatCurrency($value, $this->getCurrency()); |
235 | 235 | } else { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * Loads date from drop down list data. |
484 | 484 | * @param string $key the key that can be used to retrieve data from the input data collection |
485 | 485 | * @param array $values the input data collection |
486 | - * @return array the date selected |
|
486 | + * @return string the date selected |
|
487 | 487 | */ |
488 | 488 | protected function getDateFromPostData($key, $values) |
489 | 489 | { |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |
598 | - * @return DateTimeFormatInfo date time format information for the current culture. |
|
598 | + * @return CultureInfo date time format information for the current culture. |
|
599 | 599 | */ |
600 | 600 | protected function getLocalizedCalendarInfo() |
601 | 601 | { |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | /** |
648 | 648 | * Renders the calendar drop down list depending on the DateFormat pattern. |
649 | 649 | * @param THtmlWriter $writer the Html writer to render the drop down lists. |
650 | - * @param array $date the current selected date |
|
650 | + * @param \DateTime $date the current selected date |
|
651 | 651 | */ |
652 | 652 | protected function renderCalendarSelections($writer, $date) |
653 | 653 | { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | * Returns the localized month names that depends on the month format pattern. |
756 | 756 | * "MMMM" will return the month names, "MM" or "MMM" return abbr. month names |
757 | 757 | * and "M" return month digits. |
758 | - * @param DateTimeFormatInfo $info localized date format information. |
|
758 | + * @param CultureInfo $info localized date format information. |
|
759 | 759 | * @return array localized month names. |
760 | 760 | */ |
761 | 761 | protected function getLocalizedMonthNames($info) |
@@ -205,7 +205,6 @@ discard block |
||
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Load the ICU culture data for the specific culture identifier. |
208 | - * @param string $culture the culture identifier. |
|
209 | 208 | */ |
210 | 209 | protected function loadCultureData($key) |
211 | 210 | { |
@@ -259,7 +258,6 @@ discard block |
||
259 | 258 | * Search the array for a specific value using a path separated using |
260 | 259 | * slash "/" separated path. e.g to find $info['hello']['world'], |
261 | 260 | * the path "hello/world" will return the corresponding value. |
262 | - * @param array $info the array for search |
|
263 | 261 | * @param string $path slash "/" separated array path. |
264 | 262 | * @return mixed the value array using the path |
265 | 263 | */ |
@@ -401,7 +399,6 @@ discard block |
||
401 | 399 | * Simplify a single element array into its own value. |
402 | 400 | * E.g. <code>array(0 => array('hello'), 1 => 'world');</code> |
403 | 401 | * becomes <code>array(0 => 'hello', 1 => 'world');</code> |
404 | - * @param array $array with single elements arrays |
|
405 | 402 | * @return array simplified array. |
406 | 403 | */ |
407 | 404 | protected function simplify($obj) |
@@ -474,7 +471,7 @@ discard block |
||
474 | 471 | |
475 | 472 | /** |
476 | 473 | * Get a list of timezones in the language of the localized version. |
477 | - * @return array list of localized timezones. |
|
474 | + * @return string[] list of localized timezones. |
|
478 | 475 | */ |
479 | 476 | public function getTimeZones() |
480 | 477 | { |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function loadCultureData($key) |
211 | 211 | { |
212 | - foreach(self::$bundleNames as $bundleKey => $bundleName) |
|
212 | + foreach (self::$bundleNames as $bundleKey => $bundleName) |
|
213 | 213 | { |
214 | - if($key == $bundleKey) |
|
214 | + if ($key == $bundleKey) |
|
215 | 215 | { |
216 | - if(!array_key_exists($this->culture, self::$data)) |
|
216 | + if (!array_key_exists($this->culture, self::$data)) |
|
217 | 217 | self::$data[$this->culture] = []; |
218 | 218 | |
219 | 219 | self::$data[$this->culture][$bundleKey] = \ResourceBundle::create($this->culture, $bundleName, true); |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | * @param string $key bundle name. |
232 | 232 | * @return mixed the specific ICU data. |
233 | 233 | */ |
234 | - public function findInfo($path='/', $key = null) |
|
234 | + public function findInfo($path = '/', $key = null) |
|
235 | 235 | { |
236 | - if($key === null) |
|
236 | + if ($key === null) |
|
237 | 237 | { |
238 | 238 | // try to guess the bundle from the path. Always defaults to "Core". |
239 | 239 | $key = 'Core'; |
240 | - foreach(self::$bundleNames as $bundleName => $icuBundleName) |
|
240 | + foreach (self::$bundleNames as $bundleName => $icuBundleName) |
|
241 | 241 | { |
242 | - if(strpos($path, $bundleName) === 0) |
|
242 | + if (strpos($path, $bundleName) === 0) |
|
243 | 243 | { |
244 | 244 | $key = $bundleName; |
245 | 245 | break; |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | - if(!array_key_exists($this->culture, self::$data)) |
|
250 | + if (!array_key_exists($this->culture, self::$data)) |
|
251 | 251 | $this->loadCultureData($key); |
252 | - if(!array_key_exists($this->culture, self::$data) || !array_key_exists($key, self::$data[$this->culture])) |
|
252 | + if (!array_key_exists($this->culture, self::$data) || !array_key_exists($key, self::$data[$this->culture])) |
|
253 | 253 | return []; |
254 | 254 | |
255 | 255 | return $this->searchResources(self::$data[$this->culture][$key], $path); |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | * @param string $path slash "/" separated array path. |
264 | 264 | * @return mixed the value array using the path |
265 | 265 | */ |
266 | - private function searchResources($resource, $path='/') |
|
266 | + private function searchResources($resource, $path = '/') |
|
267 | 267 | { |
268 | 268 | $index = explode('/', $path); |
269 | - for($i = 0, $k = count($index); $i < $k; ++$i) |
|
269 | + for ($i = 0, $k = count($index); $i < $k; ++$i) |
|
270 | 270 | { |
271 | - if(is_object($resource)) |
|
271 | + if (is_object($resource)) |
|
272 | 272 | $resource = $resource->get($index[$i]); |
273 | 273 | } |
274 | 274 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | $reg = substr($this->culture, 3, 2); |
307 | 307 | $language = $this->findInfo("Languages/{$lang}"); |
308 | 308 | $region = $this->findInfo("Countries/{$reg}"); |
309 | - if($region) |
|
310 | - return $language.' ('.$region.')'; |
|
309 | + if ($region) |
|
310 | + return $language . ' (' . $region . ')'; |
|
311 | 311 | else |
312 | 312 | return $language; |
313 | 313 | } |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | $region = $culture->findInfo("Countries/{$reg}"); |
333 | - if($region) |
|
334 | - return $language.' ('.$region.')'; |
|
333 | + if ($region) |
|
334 | + return $language . ' (' . $region . ')'; |
|
335 | 335 | else |
336 | 336 | return $language; |
337 | 337 | } |
@@ -372,25 +372,25 @@ discard block |
||
372 | 372 | * or CultureInfo::SPECIFIC. |
373 | 373 | * @return array list of culture information available. |
374 | 374 | */ |
375 | - public static function getCultures($type=CultureInfo::ALL) |
|
375 | + public static function getCultures($type = CultureInfo::ALL) |
|
376 | 376 | { |
377 | 377 | $all = \ResourceBundle::getLocales(''); |
378 | 378 | |
379 | - switch($type) |
|
379 | + switch ($type) |
|
380 | 380 | { |
381 | 381 | case CultureInfo::ALL : |
382 | 382 | return $all; |
383 | 383 | case CultureInfo::NEUTRAL : |
384 | - foreach($all as $key => $culture) |
|
384 | + foreach ($all as $key => $culture) |
|
385 | 385 | { |
386 | - if(strlen($culture) != 2) |
|
386 | + if (strlen($culture) != 2) |
|
387 | 387 | unset($all[$key]); |
388 | 388 | } |
389 | 389 | return $all; |
390 | 390 | case CultureInfo::SPECIFIC : |
391 | - foreach($all as $key => $culture) |
|
391 | + foreach ($all as $key => $culture) |
|
392 | 392 | { |
393 | - if(strlen($culture) == 2) |
|
393 | + if (strlen($culture) == 2) |
|
394 | 394 | unset($all[$key]); |
395 | 395 | } |
396 | 396 | return $all; |
@@ -406,17 +406,17 @@ discard block |
||
406 | 406 | */ |
407 | 407 | protected function simplify($obj) |
408 | 408 | { |
409 | - if(is_scalar($obj)) { |
|
409 | + if (is_scalar($obj)) { |
|
410 | 410 | return $obj; |
411 | - } elseif($obj instanceof \ResourceBundle) { |
|
411 | + } elseif ($obj instanceof \ResourceBundle) { |
|
412 | 412 | $array = []; |
413 | - foreach($obj as $k => $v) |
|
413 | + foreach ($obj as $k => $v) |
|
414 | 414 | $array[$k] = $v; |
415 | 415 | } else { |
416 | 416 | $array = $obj; |
417 | 417 | } |
418 | 418 | |
419 | - for($i = 0, $k = count($array); $i<$k; ++$i) |
|
419 | + for ($i = 0, $k = count($array); $i < $k; ++$i) |
|
420 | 420 | { |
421 | 421 | $key = key($array); |
422 | 422 | if ($key !== null |
@@ -445,10 +445,10 @@ discard block |
||
445 | 445 | public function getCurrencies() |
446 | 446 | { |
447 | 447 | static $arr; |
448 | - if($arr === null) |
|
448 | + if ($arr === null) |
|
449 | 449 | { |
450 | 450 | $arr = $this->findInfo('Currencies', 'Currencies'); |
451 | - foreach($arr as $k => $v) |
|
451 | + foreach ($arr as $k => $v) |
|
452 | 452 | $arr[$k] = $this->simplify($v); |
453 | 453 | } |
454 | 454 | return $arr; |
@@ -479,15 +479,15 @@ discard block |
||
479 | 479 | public function getTimeZones() |
480 | 480 | { |
481 | 481 | static $arr; |
482 | - if($arr === null) |
|
482 | + if ($arr === null) |
|
483 | 483 | { |
484 | 484 | $validPrefixes = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Etc', 'Europe', 'Indian', 'Pacific'); |
485 | 485 | $tmp = $this->findInfo('zoneStrings', 'zoneStrings'); |
486 | - foreach($tmp as $k => $v) |
|
486 | + foreach ($tmp as $k => $v) |
|
487 | 487 | { |
488 | - foreach($validPrefixes as $prefix) |
|
488 | + foreach ($validPrefixes as $prefix) |
|
489 | 489 | { |
490 | - if(strpos($k, $prefix) === 0) |
|
490 | + if (strpos($k, $prefix) === 0) |
|
491 | 491 | { |
492 | 492 | $arr[] = str_replace(':', '/', $k); |
493 | 493 | break; |
@@ -410,8 +410,9 @@ discard block |
||
410 | 410 | return $obj; |
411 | 411 | } elseif($obj instanceof \ResourceBundle) { |
412 | 412 | $array = []; |
413 | - foreach($obj as $k => $v) |
|
414 | - $array[$k] = $v; |
|
413 | + foreach($obj as $k => $v) { |
|
414 | + $array[$k] = $v; |
|
415 | + } |
|
415 | 416 | } else { |
416 | 417 | $array = $obj; |
417 | 418 | } |
@@ -448,8 +449,9 @@ discard block |
||
448 | 449 | if($arr === null) |
449 | 450 | { |
450 | 451 | $arr = $this->findInfo('Currencies', 'Currencies'); |
451 | - foreach($arr as $k => $v) |
|
452 | - $arr[$k] = $this->simplify($v); |
|
452 | + foreach($arr as $k => $v) { |
|
453 | + $arr[$k] = $this->simplify($v); |
|
454 | + } |
|
453 | 455 | } |
454 | 456 | return $arr; |
455 | 457 | } |