= 1024 && $unit < count($units) - 1) { $value /= 1024; $unit++; } return ($unit === 0 ? number_format($value, 0) : number_format($value, 2)) . ' ' . $units[$unit]; } public static function date(?string $value): string { if ($value === null || $value === '') { return 'Never'; } $timestamp = strtotime($value); if ($timestamp === false) { return $value; } return date('M j, Y g:i A', $timestamp); } /** * @param array $tags */ public static function tagString(array $tags): string { $parts = []; foreach ($tags as $key => $value) { $parts[] = $key . '=' . $value; } return implode(', ', $parts); } }