mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 19:35:16 +00:00
Set upload size as "***MB" would give errors.
This commit is contained in:
@@ -34,6 +34,7 @@ use stdClass;
|
||||
|
||||
/**
|
||||
* Class Steam.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Steam
|
||||
@@ -520,6 +521,7 @@ class Steam
|
||||
if (null === $amount) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
@@ -530,25 +532,25 @@ class Steam
|
||||
*/
|
||||
public function phpBytes(string $string): int
|
||||
{
|
||||
$string = strtolower($string);
|
||||
$string = str_replace(['kb', 'mb', 'gb'], ['k', 'm', 'g'], strtolower($string));
|
||||
|
||||
if (false !== stripos($string, 'k')) {
|
||||
// has a K in it, remove the K and multiply by 1024.
|
||||
$bytes = bcmul(rtrim($string, 'kK'), '1024');
|
||||
$bytes = bcmul(rtrim($string, 'k'), '1024');
|
||||
|
||||
return (int)$bytes;
|
||||
}
|
||||
|
||||
if (false !== stripos($string, 'm')) {
|
||||
// has a M in it, remove the M and multiply by 1048576.
|
||||
$bytes = bcmul(rtrim($string, 'mM'), '1048576');
|
||||
$bytes = bcmul(rtrim($string, 'm'), '1048576');
|
||||
|
||||
return (int)$bytes;
|
||||
}
|
||||
|
||||
if (false !== stripos($string, 'g')) {
|
||||
// has a G in it, remove the G and multiply by (1024)^3.
|
||||
$bytes = bcmul(rtrim($string, 'gG'), '1073741824');
|
||||
$bytes = bcmul(rtrim($string, 'g'), '1073741824');
|
||||
|
||||
return (int)$bytes;
|
||||
}
|
||||
@@ -606,7 +608,8 @@ class Steam
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLocaleArray(string $locale): array {
|
||||
public function getLocaleArray(string $locale): array
|
||||
{
|
||||
return [
|
||||
sprintf('%s.utf8', $locale),
|
||||
sprintf('%s.UTF-8', $locale),
|
||||
|
Reference in New Issue
Block a user