public function convertToString($input, $separator = ' '): string
    {
        $separator = (string)$separator;
        $string = is_array($input) ? implode($separator, $input) : (string)$input;

        // Remove double space and trim the string
        return trim(preg_replace('/(\s)+/', ' ', $string));
    }