Get diskspace

@param  string $path
@return int
342765
public function disk_space($path = '/')
    {
        if ($this->host_os === 'WINDOWS') {
            $wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
            $disks =  $wmi->ExecQuery("Select * from Win32_LogicalDisk");

            foreach ($disks as $d) {
                if ($d->Name == $path) {
                    $ds = $d->Size;
                    $df = $d->FreeSpace;
                }
            }
        } else {
            $ds = disk_total_space($path);
            $df = disk_free_space($path);
        }
        return ($df > 0 && $ds > 0 && $df < $ds) ? floor($df/$ds * 100) : 0;
    }
1226936
public function getMetadata($path)
    {
        $url = self::BASE_URI.$this->getPathUnderRootDrive($path);

        return $this->getResponse('GET', $url);
    }
172094
public function getSize($path)
    {
        $file_info = $this->getMetadata($path);
        return $file_info != false && $file_info['content-length'] > 0 ? [ 'size' => $file_info['content-length'] ] : ['size' => 0];
    }
1057539
public static function getMd5($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return false;
        }

        return md5_file($path);
    }
41251
public static function getNamespace(string $path) : string
    {
        $source = file_get_contents($path);

        if($source === false) {
            add_action( 'admin_notices',function() use($path) {
                $malfunctionalPlugin = array_pop(get_plugins( "/" . explode( '/', plugin_basename( $path ))[0]));
                printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr('notice notice-error'), esc_html("ERROR: Could not find module definition (file) in " . $malfunctionalPlugin['Name']));
            });
        }

        $tokens = token_get_all($source);
        $count = count($tokens);
        $i = 0;
        $namespace = '';
        $namespaceFound = false;

        while ($i < $count) {
            $token = $tokens[$i];

            if (is_array($token) && $token[0] === T_NAMESPACE) {
                // Found namespace declaration
                while (++$i < $count) {
                    if ($tokens[$i] === ';') {
                        $namespaceFound = true;
                        $namespace = trim($namespace);
                        break;
                    }

                    $namespace .= is_array($tokens[$i]) ? $tokens[$i][1] : $tokens[$i];
                }

                break;
            }

            $i++;
        }

        if (!$namespaceFound) {
            return '';
        }

        return $namespace;
    }
150762
public function getMetadata($path)
    {
        $location = $this->applyPathPrefix($path);
        return $this->ossClient->getObjectMeta($this->bucket, $location);
    }
181170
public static function getFileMimeByFinfo($path)
    {
        if (empty($path) || ! is_file($path)) {
            return null;
        }
        
        $finfo = new \finfo(FILEINFO_MIME_TYPE);
        return $finfo->file($path);
    }
185264
public static function dirMTime($path)
    {
        clearstatcache();
        return max(
            array_map(
                function ($f) {
                    return filemtime($f);
                },
                self::listDirRecursive($path)
            ),
            filemtime($path)
        );
    }
610476
public function getDirectoryName(string $path) : string
    {
        if (!$this->exists($path)) {
            throw new FileSystemException("File at path $path not found");
        }

        return pathinfo($path, PATHINFO_DIRNAME);
    }
1023108
public static function dirsize(string $path) {
		$size = 0;
		$files = static::scandir($path, true, false);
		foreach ($files as $v) {
			$size += @\filesize($v);
		}
		return $size;
	}
1134171
public function getSection($path)
	{
		$parts = explode('.', $path);
		return (count($parts) === 1)
			? 'PHP' : ucwords(strtolower($parts[0]));
	}
581643
function getTotalSpace(): float {
		$directory = $this->isDirectory () ? $this->fileName : $this->getParent ();
		return disk_total_space ( $directory );
	}
767967
public function get($path)
    {
        $path = self::validatePath($path);
        $fullPath = $this->getMediaPath($path);
        return $this->getStorageDisk()->get($fullPath);
    }
874103
protected function countSize($path) {
		$stat = $this->stat($path);

		if (empty($stat) || !$stat['read'] || !empty($stat['hidden'])) {
			return 'unknown';
		}
		
		if ($stat['mime'] != 'directory') {
			return $stat['size'];
		}
		
		$subdirs = $this->options['checkSubfolders'];
		$this->options['checkSubfolders'] = true;
		$result = 0;
		foreach ($this->getScandir($path) as $stat) {
			$size = $stat['mime'] == 'directory' && $stat['read'] 
				? $this->countSize($this->_joinPath($path, $stat['name'])) 
				: $stat['size'];
			if ($size > 0) {
				$result += $size;
			}
		}
		$this->options['checkSubfolders'] = $subdirs;
		return $result;
	}
76703
public static function getCount($path)
    {
        $response = self::connection()->get(self::$api_path . $path);

        if ($response == false || is_string($response)) {
            return $response;
        }

        return $response->count;
    }
1081115
public static function rrmdir($path) {
		if (is_file($path)) {
			return unlink($path);
		} elseif (is_dir($path)) {
			$dir_members = scandir($path);
			foreach ($dir_members as $member) {
				if ($member !== '.' && $member !== '..') {
					static::rrmdir($path.'/'.$member);
				}
			}
			return @rmdir($path);
		}
	}
109469
public static function size($path)
    {
        $path = ltrim(self::fullpath($path), '/');

        $ch = curl_init('file://' . $path);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_NOBODY, true);

        $headers = curl_exec($ch);
        curl_close($ch);

        $ch = null;

        if (preg_match('#content-length:(\s+?|)(\d+)#i', $headers, $matches)) {
            return $matches[2];
        }

        return false;
    }