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);
}
}