protected function escapeList($list)
    {
        $result = [];
        foreach ($list as $v) {
            if (!is_array($v)) {
                $result[] = $v;
                continue;
            }
            $result[] = $this->escapeList($v);
        }
        return '(' . implode(' ', $result) . ')';
    }
protected function escapeList($list)
    {
        $result = [];
        foreach ($list as $v) {
            if (!is_array($v)) {
                $result[] = $v;
                continue;
            }
            $result[] = $this->escapeList($v);
        }
        return '(' . implode(' ', $result) . ')';
    }
protected function escapeList ( $ list ) { $ result = [ ] ; foreach ( $ list as $ v ) { if ( ! is_array ( $ v ) ) { $ result [ ] = $ v ; continue ; } $ result [ ] = $ this -> escapeList ( $ v ) ; } return '(' . implode ( ' ' , $ result ) . ')' ; }
escape a list with literals or lists

@param  array $list list with literals or lists as PHP array
@return string escaped list for imap
escape a list with literals or lists