Skip to content

Commit

Permalink
Add missing break statements to File::sizeToBytes()
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers authored Nov 5, 2024
1 parent e39ab56 commit d399f4e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,20 @@ public function sizeToBytes(string $size): string
switch ($unit) {
case 'gb':
case 'g':
$value = ($value * 1024 * 1024 * 1024);
$value *= 1024 * 1024 * 1024;
break;
case 'mb':
case 'm':
$value = ($value * 1024 * 1024);
$value *= 1024 * 1024;
break;
case 'kb':
case 'k':
$value = ($value * 1024);
$value *= 1024;
break;
case 'byte':
case 'bytes':
$value = $value;
// No multiplication needed; already in bytes
break;
default:
throw new \InvalidArgumentException("Unknown size unit '$unit'");
}
Expand All @@ -123,7 +127,6 @@ public function sizeToBytes(string $size): string
throw new \InvalidArgumentException("Invalid size format '$size'");
}


/**
* Returns a public file path from an absolute path.
*
Expand Down

0 comments on commit d399f4e

Please sign in to comment.