/** * Gets the size of the directory and all subfolders and files * * @param string $dir The path of the directory * @return mixed */ public static function size($dir) { if (!file_exists($dir)) { return false; } // It's easier to handle this with the Folder class $object = new Folder($dir); return $object->size(); }
/** * Whether free place in folder to this file size * @param Folder $folder * @param $fileSize * @return bool */ private function hasFreeSpace(Folder $folder, $fileSize) { return $this->_config['folder_size_max'] - $folder->size() >= $fileSize; }