Attempts to convert an array to YAML
@access private
@return string
@param $array The array you want to convert
@param $indent The indent of the current level
776628
private function _yamlizeArray($array,$indent) {
		if (is_array($array)) {
			$string = '';
			foreach ($array as $key => $value) {
				$string .= $this->_yamlize($key,$value,$indent);
			}
			return $string;
		} else {
			return FALSE;
		}
	}
699769
protected function renderPayloadDataAsMarkupList(array $data, $indent = 0) {
		$markup = '';
		foreach ($data as $key => $value) {
			$markup .= str_repeat(' ', $indent * 2) . '- ' . $key . ':';
			if (TRUE === is_array($value)) {
				$markup .= $this->renderPayloadDataAsMarkupList($value, ++ $indent);
			} else {
				$markup .= ' ' . $value . PHP_EOL;
			}
		}
		return TRUE === empty($markup) ? '' : PHP_EOL . $markup;
	}
334575
public static function indentLines($lines, $indent = '  ')
    {
        $lineSeparator = "\n";
        $buffer        = '';
        $line          = strtok($lines, $lineSeparator);
        while ($line) {
            $buffer .= $indent . $line . $lineSeparator;
            $line = strtok($lineSeparator);
        }
        strtok(null, null);

        return $buffer;
    }
896205
public static function convertArrayToFlatTextArray(array $array) {
    $rows = [];
    $max_line_length = 60;
    foreach ($array as $key => $value) {
      if (is_array($value)) {
        $flattened_array = self::flattenToDotNotatedKeys($value);
        foreach ($flattened_array as $sub_key => $sub_value) {
          if ($sub_value === TRUE) {
            $sub_value = 'true';
          }
          elseif ($sub_value === FALSE) {
            $sub_value = 'false';
          }
          $rows[] = [
            "$key.$sub_key",
            wordwrap($sub_value, $max_line_length, "\n", TRUE),
          ];
        }
      }
      else {
        if ($value === TRUE) {
          $contents = 'true';
        }
        elseif ($value === FALSE) {
          $contents = 'false';
        }
        else {
          $contents = wordwrap($value, $max_line_length, "\n", TRUE);
        }
        $rows[] = [$key, $contents];
      }
    }

    return $rows;
  }
827167
private function flatten(array $array, array &$result, string $keySeparator, string $parentKey = '', bool $escapeFormulas = false)
    {
        foreach ($array as $key => $value) {
            if (\is_array($value)) {
                $this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator, $escapeFormulas);
            } else {
                if ($escapeFormulas && \in_array(substr($value, 0, 1), $this->formulasStartCharacters, true)) {
                    $result[$parentKey.$key] = "\t".$value;
                } else {
                    $result[$parentKey.$key] = $value;
                }
            }
        }
    }
1262734
public function toString($indent = null)
    {
        $helperManager = $this->getView()->getHelperPluginManager();
        if ($helperManager->has('dojo')) {
            $dojo = $helperManager->get('dojo');
            $dojo->initialize();
        }
        return parent::toString($indent);
    }
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;
    }
166144
public function indent($level = null)
    {
        $level = $level ?: $this->getLevel();
        array_push($this->indentStack, $level);

        return $level;
    }
1281186
protected static function convertArrayToString( $array, $breakMode, $level = 1 )
	{
		$list = array();
		foreach( $array as $key => $value )
		{
			$string	= self::convertArgumentToString( $value, $breakMode, $level+1 );
			$list[]	= $key.":".$string;
		}
		$block	= implode( ", ", $list );
		if( $breakMode == 2 )
		{
			$level	= str_repeat( "&nbsp;", 3 * $level );
			$indent	= str_repeat( "&nbsp;", 3 );
			$list	= implode( ",<br/>".$level.$indent.$indent.$indent.$indent, $list );
			$block	= "<br/>".$level.$indent.$indent.$indent.$indent.$list."<br/>".$level.$indent.$indent.$indent;
		}
		if( $breakMode == 3 )
		{
			$block	= self::blockquote( implode( ',<br/>', $list ) );
		}
		return '{'.$block.'}';
	}
274264
protected function indentArray(array $elements) {
		return self::INDENTATION . \str_replace(PHP_EOL, PHP_EOL . self::INDENTATION, \implode(PHP_EOL, $elements));
	}
1113416
public static function arrayToKey(array $array): string {
        $result = "";
        \array_walk_recursive($array, function ($key, $value) use (&$result) {
            $result .= $key . $value;
        });
        return $result;
    }
609867
protected function generateArrayLines(array $values, $level = 1, $indentation = '    ')
    {
        $index = 0;
        $lines = [];
        $count = count($values);

        foreach ($values as $key => $value) {
            $index  = $index + 1;
            $comma  = ($index < $count) ? ',' : '';

            $lines[] = "'$key' => " . $value . $comma;
        }

        if ($level === 0) {
            return $lines;
        }

        return $this->addIndentation($lines, $level, $indentation);
    }
565936
protected function dumpToSimpleYaml($array)
    {
        $parts = [];

        foreach ($array as $key => $value) {
            $parts[] = "$key: $value";
        }

        $yaml = implode("\n", $parts);

        return $yaml;
    }
1155653
function compile($indent) {
		$function_name = $this->function_name( $this->name ) ;
		
		// Build the typestack
		$typestack = array(); $class=$this;
		do {
			$typestack[] = $this->function_name($class->name);
		}
		while($class = $class->extends);

		$typestack = "array('" . implode("','", $typestack) . "')";
		
		// Build an array of additional arguments to add to result node (if any)
		if (empty($this->arguments)) {
			$arguments = 'null';
		}
		else {
			$arguments = "array(";
			foreach ($this->arguments as $k=>$v) { $arguments .= "'$k' => '$v'"; }
			$arguments .= ")";
		}
		
		$match = PHPBuilder::build() ;
		
		$match->l("protected \$match_{$function_name}_typestack = $typestack;");

		$match->b( "function match_{$function_name} (\$stack = array())",
			'$matchrule = "'.$function_name.'"; $result = $this->construct($matchrule, $matchrule, '.$arguments.');',
			$this->parsed->compile()->replace(array(
				'MATCH' => 'return $this->finalise($result);',
				'FAIL' => 'return FALSE;'
			))
		);

		$functions = array() ;
		foreach( $this->functions as $name => $function ) {
			$function_name = $this->function_name( preg_match( '/^_/', $name ) ? $this->name.$name : $this->name.'_'.$name ) ;
			$functions[] = implode( PHP_EOL, array(
				'function ' . $function_name . ' ' . $function
			));
		}

		// print_r( $match ) ; return '' ;
		return $match->render(NULL, $indent) . PHP_EOL . PHP_EOL . implode( PHP_EOL, $functions ) ;
	}
1015873
public function getString($indent = 2, $wordWrap = false)
    {
        $res = $this->driverInstance->getString($indent, $wordWrap);
        if (!$this->isString($res) && !$this->isStringObject($res)) {
            throw new YamlException('YamlInterface method _getString() must return a string or StringObject.');
        }

        return StdObjectWrapper::toString($res);
    }
357585
public function write_files($files, $indent) {
        if (empty($files)) {
            return '';
        }
        $string = '';
        foreach ($files as $file) {
            if ($file->is_directory()) {
                continue;
            }
            $string .= str_repeat('  ', $indent);
            $string .= '<file name="' . $file->get_filename() . '" encoding="base64">';
            $string .= base64_encode($file->get_content());
            $string .= "</file>\n";
        }
        return $string;
    }
779148
protected function implode( $array )
    {
        $retString = '';
        if ( empty( $array ) )
        {
            return '';
        }
        foreach ( $array as $key => $value )
        {
            if ( is_array( $value ) )
            {
                $value = $this->implode( $value );
            }
            $retString .= $key . ' ' . $value . ' ';
        }

        return $retString;
    }