HM\BackUpWordPress\Site_Size::filesize PHP Method

filesize() public method

If $file is a file then return the result of filesize() or 0 if it's excluded. If $file is a directory then recursively calculate the size without the size of excluded files/directories.
public filesize ( SplFileInfo $file ) : integer
$file SplFileInfo The file or directory you want to know the size of.
return integer The total filesize of the file or directory without the size of excluded files/directories.
    public function filesize(\SplFileInfo $file)
    {
        // Skip missing or unreadable files.
        if (!file_exists($file->getPathname()) || !$file->getRealpath() || !$file->isReadable()) {
            return 0;
        }
        // If it's a file then return its filesize or 0 if it's excluded.
        if ($file->isFile()) {
            if ($this->excludes && $this->excludes->is_file_excluded($file)) {
                return 0;
            } else {
                return $file->getSize();
            }
        }
        // If it's a directory then pull it from the cached filesize array.
        if ($file->isDir()) {
            return $this->directory_filesize($file);
        }
    }