totalBytes === 0) { return 0.0; } return ($this->usedBytes / $this->totalBytes) * 100; } /** * Prüft, ob die Disk fast voll ist (>90%). */ public function isAlmostFull(): bool { return $this->getUsagePercentage() > 90; } /** * Gibt Total als Byte Value Object zurück. */ public function getTotal(): Byte { return Byte::fromBytes($this->totalBytes); } /** * Gibt Used als Byte Value Object zurück. */ public function getUsed(): Byte { return Byte::fromBytes($this->usedBytes); } /** * Gibt Available als Byte Value Object zurück. */ public function getAvailable(): Byte { return Byte::fromBytes($this->availableBytes); } /** * Konvertiert zu Array. * * @return array */ public function toArray(): array { return [ 'mount_point' => $this->mountPoint, 'total_bytes' => $this->totalBytes, 'total_human' => $this->getTotal()->toHumanReadable(), 'used_bytes' => $this->usedBytes, 'used_human' => $this->getUsed()->toHumanReadable(), 'available_bytes' => $this->availableBytes, 'available_human' => $this->getAvailable()->toHumanReadable(), 'usage_percentage' => round($this->getUsagePercentage(), 2), 'is_almost_full' => $this->isAlmostFull(), ]; } }