Converts array to string
@param  array  $arr
@param  string $glue
@return string
@throws \Exception
331002
private function Array2string($arr, $glue = '&') {
    if (!is_array($arr)) {
      throw new Exception('Argument arr must be array');;
    }
    $new = array();
    foreach ($arr as $k => $v) {
      $new[] = urlencode($k) .'='. urlencode($v);
    }
    return implode($glue, $new);
  }
851140
final private function referencedArgs(&$arr)
    {
        if (strnatcmp(phpversion(), '5.3') >= 0) { //Reference is required for PHP 5.3+
            $refs = array();
            foreach ($arr as $key => $value)
                $refs[] = &$arr[$key];
            return $refs;
        }

        return $arr;
    }
237599
public function append($arr)
    {
        
        if (is_a($arr, DictionaryInterface::class)) {
            $arr = $arr->getDictionary();
        }
        elseif (false === is_array($arr)){
            throw new \Exception("Not an array", 5);
        }
        
        foreach ($arr as $key => $val) {
            if (is_numeric($key)) {
                $this->setString($key, $key);
            } else {
                $this->setString($key, $val);
            }
        }
        
        return $this;
    }
1175878
public static function deserializeObject(array $arr)
    {
        /** @var Filter $result */
        $result = parent::deserializeObject($arr);
        $result->maxResults = $arr['maxResults'];

        return $result;
    }
194718
public function fixPrevNext(&$arr) {
        $tweaked = false;

        $prev = null;
        foreach ($arr as $key=>$el) {
            $prev_value = $arr[$key]->previous;
            $next_value = $arr[$key]->next;

            $arr[$key]->next     = null;
            $arr[$key]->previous = null;
            if ($prev !== null) {
                $arr[$prev]->next    = $arr[$key]->name;
                $arr[$key]->previous = $arr[$prev]->name;
            }
            $prev = $key;

            if ($prev_value != $arr[$key]->previous or $next_value != $arr[$key]->next) {
                $tweaked = true;
            }
        }

        return $tweaked;
    }
526040
static public function implode($glue, $data)
	{
	    if (is_array($data)) {
	        if (is_array(current($data))) {
	            foreach ($data as $k => $v) {
	                $data[$k] = implode($glue, $v);
	            }
	        }
	        
	        return implode($glue, $data);
	    }
	    return $data;
	}
79278
protected function recursiveImplode(string $glue, array $array): string
    {
        $return = '';
        $index = 0;
        $count = count($array);
        foreach ($array as $row) {
            if (is_array($row)) {
                $return .= $this->recursiveImplode($glue, $row);
            } else {
                $return .= (is_object($row)) ? get_class($row) : $row;
            }
            if ($index < $count - 1) {
                $return .= $glue;
            }
            ++$index;
        }

        return $return;
    }
528106
protected function checkParam($param, string $glue = ' '): string
    {
        if (is_array($param)) {
            $param = implode($glue, $param);
        }

        return $param;
    }
981700
public function renderManyString(
        array $issues,
        $format = null,
        $glue = null
    ) {
        if (null === $format) {
            $format = '  - %s';
        }
        if (null === $glue) {
            $glue = "\n";
        }

        $self = $this;

        return implode(
            $glue,
            array_map(function (ValidationIssue $issue) use ($self, $format) {
                return sprintf($format, $self->render($issue));
            }, $issues)
        );
    }
326976
protected function prepareTree(array $arr) {
        $tree = [];
        foreach ($arr as $a) {
            $name = $a->getName();
            $cur = &$tree;
            foreach (explode("-", $name) as $e) {
                if (empty($cur[$e])) $cur[$e] = [];
                $cur = &$cur[$e];
            }
        }
        return $tree;
    }
601946
public static function values($arr)
    {
        if (!is_array($arr)) {
            return '';
        }
        $arr = array_values($arr);
        foreach ($arr as &$v) {
            $v = static::value($v);
        }
        return implode(',', $arr);
    }
100704
public static function array_to_object($arr)
    {
        if (gettype($arr) != 'array') {
            return $arr;
        }
        foreach ($arr as $k => $v) {
            if (gettype($v) == 'array' || getType($v) == 'object') {
                $arr[$k] = self::array_to_object($v);
            }
        }
        return (object)$arr;
    }
1349093
private function implodeArray(array $arr)
    {
        $values = [];

        foreach ($arr as $value) {
            if (is_array($value)) {
                $values[] = $this->implodeArray($value);
            } else {
                $values[] = $value;
            }
        }

        return "{" . implode(",", $values) . "}";
    }
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 );
    }
109267
private function genLine(array $array, string $glue, string $name): string
    {
        $line = '';
        $i = 0;
        foreach ($array as $key => $value) {
            $line .= (($i === 0) ? null : $glue) . "$key = :${name}_$key";
            $i = 1;
        }
        return $line;
    }
936601
public static function flatten($array, $glue = ':', $reset = true, $indexed = true)
    {
        static $return = array();
        static $curr_key = array();

        if ($reset) {
            $return = array();
            $curr_key = array();
        }

        foreach ($array as $key => $val) {
            $curr_key[] = $key;
            if (is_array($val) and ($indexed or array_values($val) !== $val)) {
                static::flatten_assoc($val, $glue, false);
            } else {
                $return[implode($glue, $curr_key)] = $val;
            }
            array_pop($curr_key);
        }
        return $return;
    }
602366
public function writeArray(array $arr) {

            //Check if this is an associative array or not.
            if ( $this->isPureArray( $arr ) ) {
              // Writing the length for the numeric keys in the array
              $arrLen = count($arr);
              $arrId = ($arrLen << 1) | 0x01;
  
              $this->writeInt($arrId);
              $this->writeString('');
  
              foreach($arr as $v) {
                  $this->writeAMFData($v);
              }

            } else {
                $this->writeInt(1);
                foreach($arr as $key=>$value) {
                    $this->writeString($key);
                    $this->writeAMFData($value);
                }
                $this->writeString('');

            }

        }