Skip to content

Commit

Permalink
More compact number operations
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Oct 9, 2015
1 parent b65bfad commit 4ecafe6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion framework/captcha/CaptchaAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function validate($input, $caseSensitive)
$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);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/helpers/BaseVarDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private static function exportClosure(\Closure $closure)
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);
Expand Down
4 changes: 2 additions & 2 deletions framework/i18n/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public function asPercent($value, $decimals = null, $options = [], $textOptions
if ($decimals === null) {
$decimals = 0;
}
$value = $value * 100;
$value *= 100;
return number_format($value, $decimals, $this->decimalSeparator, $this->thousandSeparator) . '%';
}
}
Expand Down Expand Up @@ -1137,7 +1137,7 @@ private function formatSizeNumber($value, $decimals, $options, $textOptions)
if (abs($value) < $this->sizeFormatBase) {
break;
}
$value = $value / $this->sizeFormatBase;
$value /= $this->sizeFormatBase;
$position++;
} while ($position < 5);

Expand Down

0 comments on commit 4ecafe6

Please sign in to comment.