Skip to content

Commit

Permalink
new stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPetrasek committed Mar 2, 2024
1 parent 2658a22 commit b126580
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/FileUtil.php → src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Psr\Log\LoggerInterface;


class FileUtil
class File
{
function __construct
(
Expand Down
2 changes: 1 addition & 1 deletion src/HtmlUtil.php → src/Html.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Utils;

class HtmlUtil
class Html
{
public function attrs ($attry)
{
Expand Down
28 changes: 28 additions & 0 deletions src/Misc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace Utils;


class Misc
{
public function formatBytes($bytes, $precision = 2)
{
$units = array('B', 'KB', 'MB', 'GB', 'TB');

$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);

// Uncomment one of the following alternatives
$bytes /= pow(1024, $pow);
// $bytes /= (1 << (10 * $pow));

return round($bytes, $precision) . $units[$pow];
}

public function arrayToBytes($arr)
{
return mb_strlen(serialize((array)$arr), '8bit') ;
}
}

?>

0 comments on commit b126580

Please sign in to comment.