user()->language) . ' ' . $suffix[$base]; } } if (!function_exists('join_paths')) { function join_paths(string $base, string ...$paths): string { if ($base === '/') { return str_replace('//', '', implode('/', $paths)); } return str_replace('//', '', $base . '/' . implode('/', $paths)); } } if (!function_exists('resolve_path')) { function resolve_path(string $path): string { $parts = array_filter(explode('/', $path), fn (string $p) => strlen($p) > 0); $absolutes = []; foreach ($parts as $part) { if ($part == '.') { continue; } if ($part == '..') { array_pop($absolutes); } else { $absolutes[] = $part; } } return implode('/', $absolutes); } } if (!function_exists('get_ip_from_hostname')) { function get_ip_from_hostname(string $hostname): string|bool { $validARecords = @dns_get_record($hostname, DNS_A); if ($validARecords) { return collect($validARecords)->first()['ip']; } $validAAAARecords = @dns_get_record($hostname, DNS_AAAA); if ($validAAAARecords) { return collect($validAAAARecords)->first()['ipv6']; } return false; } }