mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
More compact number operations
This commit is contained in:
@ -184,7 +184,7 @@ class CaptchaAction extends Action
|
||||
$session = Yii::$app->getSession();
|
||||
$session->open();
|
||||
$name = $this->getSessionKey() . 'count';
|
||||
$session[$name] = $session[$name] + 1;
|
||||
$session[$name] += 1;
|
||||
if ($valid || $session[$name] > $this->testLimit && $this->testLimit > 0) {
|
||||
$this->getVerifyCode(true);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class BaseVarDumper
|
||||
return 'function() {/* Error: unable to determine Closure source */}';
|
||||
}
|
||||
|
||||
$start = $start - 1;
|
||||
--$start;
|
||||
|
||||
$source = implode("\n", array_slice(file($fileName), $start, $end - $start));
|
||||
$tokens = token_get_all('<?php ' . $source);
|
||||
|
@ -883,7 +883,7 @@ class Formatter extends Component
|
||||
if ($decimals === null) {
|
||||
$decimals = 0;
|
||||
}
|
||||
$value = $value * 100;
|
||||
$value *= 100;
|
||||
return number_format($value, $decimals, $this->decimalSeparator, $this->thousandSeparator) . '%';
|
||||
}
|
||||
}
|
||||
@ -1137,7 +1137,7 @@ class Formatter extends Component
|
||||
if (abs($value) < $this->sizeFormatBase) {
|
||||
break;
|
||||
}
|
||||
$value = $value / $this->sizeFormatBase;
|
||||
$value /= $this->sizeFormatBase;
|
||||
$position++;
|
||||
} while ($position < 5);
|
||||
|
||||
|
Reference in New Issue
Block a user