Pagekit\Finder\Controller\FinderController::formatFileSize PHP Method

formatFileSize() protected method

protected formatFileSize ( $size )
    protected function formatFileSize($size)
    {
        if ($size == 0) {
            return __('n/a');
        }
        $sizes = [__('%d Bytes'), __('%d  KB'), __('%d  MB'), __('%d  GB'), __('%d TB'), __('%d PB'), __('%d EB'), __('%d ZB'), __('%d YB')];
        $size = round($size / pow(1024, $i = floor(log($size, 1024))), 2);
        return sprintf($sizes[$i], $size);
    }