-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2658a22
commit b126580
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
use Psr\Log\LoggerInterface; | ||
|
||
|
||
class FileUtil | ||
class File | ||
{ | ||
function __construct | ||
( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') ; | ||
} | ||
} | ||
|
||
?> |