public static function bytes($bytes, $precision = 2)
{
$units = array('b', 'KiB', 'MiB', 'GiB', 'TiB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= 1 << 10 * $pow;
return round($bytes, $precision) . ' ' . $units[$pow];
}
protected function processFileList(array $cacheList) { $list = array(); foreach ($cacheList as $item) { $list[] = array(number_format($item['num_hits']), $item['access_time'] > 0 ? 'Yes' : 'No', $item['deletion_time'] > 0 ? 'Yes' : 'No', Formatter::bytes($item['mem_size']), $this->processFilename($item['filename'])); } return $list; }