Array concatenating method, like implode.
But it does wrap sanitizer and trims last glue

@param array $pieces
@param string $glue
@param bool $wrapSanitizer

@return string
160104
protected function arrayStr(array $pieces, string $glue = ',', bool $wrapSanitizer = true): string
    {
        $str = '';
        foreach ($pieces as $key => $piece) {
            if ($wrapSanitizer === true) {
                $piece = $this->wrapSanitizer($piece);
            }

            if (\is_int($key) === false) {
                $piece = ($wrapSanitizer ? $this->wrapSanitizer($key) : $key) . ' AS ' . $piece;
            }

            $str .= $piece . $glue;
        }

        return trim($str, $glue);
    }
824493
protected function pImplode(array $nodes, $glue = '')
    {
        $strings = $this->pIterator($nodes);
        return implode($glue, $strings);
    }
802654
public static function SelectImplode ($glue, $array, $target_key_list) {
		$tmp = [];
		foreach ($target_key_list as $key) {
			$tmp[] = $array[$key];
		}
		return implode($glue, $tmp);
	}
856553
public function implode( $glue, $propertyOrClosure = null )
    {
        if( null === $propertyOrClosure ) {
            $pieces = $this->map('strval');
        } elseif ( $propertyOrClosure instanceof \Closure ) {
            $pieces = $this->map( $propertyOrClosure );
        } else {
            $pieces = $this->map( $this->generateGetPropertyClosure( $propertyOrClosure ) );
        }
        return implode( $glue, $pieces );
    }
590183
public function fullMessages($glue = null)
    {
        $fullMessages = array();
        
        foreach ($this->errors as $attr => $errors) {
            foreach ($errors as $msg) {
                if ($attr == self::BASE_ERRORS_INDEX)
                    $fullMessages[] = $msg;
                else
                    $fullMessages[] = $this->_propper_attr($attr) . ' ' . $msg;
            }
        }
        
        if ($glue !== null)
            return implode($glue, $fullMessages);
        else
            return $fullMessages;
    }
828604
public function implode($value, $glue = ', ')
    {
        $first = $this->first();

        if (is_array($first) || is_object($first)) {
            return implode($glue, $this->pluck($value)->all());
        }

        return implode($value, $this->items);
    }
76511
public function flatten($delimiter = '.', $items = null, $prepend = '')
    {
        $flatten = [];

        if (is_null($items)) {
            $items = $this->items;
        }

        foreach ($items as $key => $value) {
            if (is_array($value) && !empty($value)) {
                $flatten = array_merge(
                    $flatten,
                    $this->flatten($delimiter, $value, $prepend.$key.$delimiter)
                );
            } else {
                $flatten[$prepend.$key] = $value;
            }
        }

        return $flatten;
    }
374858
public static String implode(String glue, Object[] pieces)
    {
        if ( pieces == null ) {
            return null;
        }
        
        StringBuffer sb = new StringBuffer();
        for ( Object o : pieces ) {
            if ( sb.length() > 0 ) {
                sb.append(glue);
            }
            
            sb.append(o.toString());
        }
        
        return sb.toString();
    }
939166
public static function implode($array, $separator = " > ")
    {
        if ($array === null) {
            return "";
        }

        $elements = [];
        foreach($array as $rawElement) {
            $element = self::sanitizeString($rawElement);

            if ($element !== null) {
                $elements[] = $element;
            }
        }

        return implode($separator, $elements);
    }
578791
public static function implodeNames($glue, $terms)
    {
        if ($terms==null || empty($terms) || is_wp_error($terms)) return '';

        $tokens = array();
        foreach ($terms as $t)
        {
            $tokens[] = $t->name;
        }

        return implode($glue, $tokens);
    }
666133
protected function concatenateQuery(array $pieces): string
    {
        $str = '';
        foreach ($pieces as $piece) {
            $str = trim($str) . ' ' . trim($piece);
        }

        return trim($str);
    }
332572
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);
        }
25540
private function getRecursivelyParam($param, array $pieces)
    {
        if (0 === count($pieces)) {
            return $param;
        }

        $key = array_shift($pieces);
        if (false === isset($param[$key])) {
            return;
        }

        return $this->getRecursivelyParam($param[$key], $pieces);
    }
525513
public function implode($value, $glue = null)
		{
			$first = $this->first();

			if (is_array($first) || is_object($first)) {
				return implode($glue, $this->lists($value));
			}

			return implode($value, $this->items);
		}
399709
public function join($glue, $finalGlue = '')
    {
        if ($finalGlue === '') {
            return $this->implode($glue);
        }

        $count = $this->count();

        if ($count === 0) {
            return '';
        }

        if ($count === 1) {
            return $this->last();
        }

        $collection = new static($this->items);

        $finalItem = $collection->pop();

        return $collection->implode($glue).$finalGlue.$finalItem;
    }
541945
public function getHeaderValue($header, $glue = '')
    {
        if ($header = $this->response->getHeader($header, true)) {
            if (is_array($header)) {
                return implode($glue, $header);
            }
        }

        return $header;
    }
204683
public static function __string($value, $glue = ', ')
    {
        if (is_object($value)) {
            if (method_exists($value, '__toString')) {
                return $value->__toString();
            }
            if ($value instanceof ArrayAccess) {
                return implode($glue, $value);
            }
            return get_class($value);
        } elseif (is_array($value)) {
            return implode($glue, $value);
        } elseif (is_bool($value)) {
            return (true===$value ? 'true' : 'false');
        } elseif (is_callable($value)) {
            return self::__closurable($value);
        }
        return (string) $value;
    }