Concatenate values of a given key as a string.

@param  string  $value
@param  string  $glue
@return string
1507
public function implode($value, $glue = null)
	{
		if (is_null($glue)) return implode($this->lists($value));

		return implode($glue, $this->lists($value));
	}
878533
public function implode($value, $glue = null): string
    {
        return $this->reduce(function ($carry, $item) use ($value, $glue) {
            $currentGlue = $glue;
            if (is_string($item) && $currentGlue === null) {
                $currentGlue = $value;
            }
            if ($carry) {
                $carry .= $currentGlue;
            }

            if ($value && ($item instanceof ArrayAccess || is_array($item))) {
                $item = $item[$value];
            }

            return $carry . $item;
        }, '');
    }
988389
protected function resolveValue($value) {
    // special treatments, if value is a string
    if (is_string($value)) {
      // replace variables denoted by a leading $
      if (strpos($value, '$') === 0) {
        $value = $this->getInstance(preg_replace('/^\$/', '', $value));
      }
      else {
        // convert booleans
        $lower = strtolower($value);
        if ($lower === 'true') {
          $value = true;
        }
        if ($lower === 'false') {
          $value = false;
        }
      }
    }
    // special treatments, if value is an array
    if (is_array($value)) {
      $result = [];
      $containsInstance = false;
      // check for variables
      foreach ($value as $val) {
        if (is_string($val) && strpos($val, '$') === 0) {
          $result[] = $this->getInstance(preg_replace('/^\$/', '', $val));
          $containsInstance = true;
        }
        else {
          $result[] = $val;
        }
      }
      // only replace value, if the array containes an variable
      if ($containsInstance) {
        $value = $result;
      }
    }
    return $value;
  }
355149
public function setAttribute($name, $value, $glue = false)
    {
        //get attributes
        $attrbs = AnConfig::unbox(pick($this->attribs, array()));

        //get the existing value
        $old = isset($attrbs[$name]) ? $attrbs[$name] : null;

        //if glue and existing value then stich the old and new using the glue
        if ($glue && $old) {
            $value = $old.(string) $glue.$value;
        }

        //put the attributes back
        $attrbs[$name] = $value;
        $this->attribs = $attrbs;

        return $this;
    }
536952
public static function string($value='', bool $flatten=false) {
		ref\cast::string($value, $flatten);
		return $value;
	}
1193989
private function decorateStringValue(string $value) : string
    {
        if ($value === '@this'){
            return "\$c";
        }
    
        if (preg_match('/^@id:(.*)$/s',$value,$matches)){
            $id = trim($matches[1]);
            return "\$c['" . self::escapeSingleQuote($id) . "']";
        }
    
        if (preg_match('/^@resolve:(.*)$/s',$value,$matches)){
            $target = trim($matches[1]);
            return "\$c[\$c->resolve('" . self::escapeSingleQuote($target) . "')]";
        }
    
        if (preg_match('/^@func:(.*)$/s',$value,$matches)){
            $func = trim($matches[1]);
            $this->validateCallable($func);
            return $func;
        }
        
        if (preg_match('/^@int:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateInteger($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@float:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateFloat($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@bool:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateBool($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@json:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateJson($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@env:(.*)$/s',$value,$matches)){
            $id = trim($matches[1]);
            return "(\$_ENV['" . self::escapeSingleQuote($id) . "'] ?? null)";
        }
    
        return "'" . self::escapeSingleQuote($value) . "'";
    }
215527
private static function tostring($value) : string
    {
        if (!isset($value)) {
            return 'NULL';
        }
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }
        if (is_numeric($value)) {
            return $value;
        }
        if (is_string($value)) {
            return "'$value'";
        }
        if (is_array($value)) {
            $out = '[';
            $i = 0;
            foreach ($value as $key => $entry) {
                if ($i) {
                    $out .= ', ';
                }
                $out .= $key.' => '.self::tostring($entry);
                $i++;
            }
            $out .= ']';
            return $out;
        }
        if (is_object($value)) {
            if (method_exists($value, '__toString')) {
                return "$value";
            } else {
                return get_class($value);
            }
        }
    }
539080
protected static function joinParam( $param = [], $join = '=', $glue = '&', $useKey = true){



        $allParam = [];

        foreach ($param as $key => $val)
        {
            if( is_array( $val ) ){
                if ($useKey && isset($val[0]) && is_array($val[0]) === false) {
                    $newValue = [];
                    foreach ($val as $element) {
                        $newValue[] = $key . $join . self::replaceCharacters($element);
                    }

                    return implode($glue, $newValue);
                } else {
                    $val = self::joinParam( $val, $join, $glue, $useKey);
                }
            }

            // ommit parameters with empty values
            if( !empty( $val )){
                #self::$urlParam[] = $useKey
                $allParam[] = $useKey
                        ? $key . $join .urlencode(URLify::downcode($val))
                        : $join .urlencode(URLify::downcode($val));
            }
        }

        // no parameters given
        if( is_null( $allParam ) ) {
            return '';
        }

        $allParam = self::replaceCharacters($allParam);

        return implode($glue, $allParam );
    }
721666
public function implode($glue, $queries)
    {
        $first = true;
        foreach ($queries as $query) {
            if ($first) {
                $first = false;
            } else {
                $this->_query .= ' ' . $glue;
            };
            $this->append($query);
        };
        return $this;
    }
602977
public function concat($value) {
        if (method_exists($this->property, 'concat')) {
            $this->property = $this->property->concat($value);
        }
        else {
            $this->property = new ODataConcatOperator($this->property, $value);
        }
        return $this;
    }
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);
		}
1013787
protected function addValue($value)
    {
        $name                = 'where' . $this->whereContainer->getBindingCount();
        $this->values[$name] = $value;

        return ':' . $name;
    }
443382
protected function valueToString($value): string
    {
        if ($value === false) {
            return 'false';
        }
        if ($value === true) {
            return 'true';
        }
        if ($value === null) {
            return 'null';
        }
        if (is_string($value)) {
            if (call_user_func(function_exists('mb_strlen') ? 'mb_strlen' : 'strlen', $value) > 100) {
                $value = call_user_func(function_exists('mb_substr') ? 'mb_substr' : 'substr', $value, 0, 97).'...';
            }
            return '"'.$value.'"';
        }
        if (is_object($value)) {
            return 'a '.get_class($value).' instance';
        }
        if (is_array($value)) {
            $keys = array_keys($value);
            $isAssociative = $keys !== array_keys($keys);
            $valuesStrings = [];

            foreach ($value as $key => $subValue) {
                $valuesStrings[] = ($isAssociative ? $this->valueToString($key).' => ' : '')
                    . $this->valueToString($subValue);
            }

            return '['.implode(', ', $valuesStrings).']';
        }
        if (is_resource($value)) {
            return 'a resource';
        }
        return (string)$value;
    }
1128373
public static function stringify($value)
    {
        $string = '';
        if (is_scalar($value)) {
            // integer, float, string, boolean
            $string = (string)$value;
        } elseif (is_resource($value)) {
            // resource
            $string = '[resource]';
        } else {
            // array, object, null, callable
            $string = json_encode($value);
        }
        return $string;
    }
557528
def implode(self, value, glue=''):
        
        first = self.first()

        if not isinstance(first, (basestring)):
            return glue.join(self.pluck(value).all())

        return value.join(self.items)
1328429
public function prepareValue($value)
    {
        return $value === null ? null : Carbon::createFromFormat($this->format, $value)->toDateString();
    }
1129479
private function parseArray(string $key, $value): string
    {
        return sprintf('%s%s%s', $key, $this->delimiter, implode(',', $value));
    }