protected function _joinIfNotEmpty($glue, $pieces)
        {
            $filtered_pieces = [];

            foreach ($pieces as $piece) {
                if (is_string($piece)) {
                    $piece = trim($piece);
                }

                if (!empty($piece)) {
                    $filtered_pieces[] = $piece;
                }
            }

            return join($glue, $filtered_pieces);
        }