构建行

@param $array

@return string
518453
static function build_line($array)
    {
        if (self::$data_sep)
        {
            $line = '';
            foreach ($array as $k => $v)
            {
                $line .= $k . self::$data_sep . $v . self::$col_sep;
            }
            return rtrim($line, self::$col_sep);
        }
        else
        {
            return implode(self::$col_sep, $array);
        }
    }
403920
private static function recursiveWalk($array) {
		foreach ($array as $k => $v) {
        if (is_array($v)) {
            $array[$k] = self::recursiveWalk($v);
        } else {
            $array[$k] = self::compareReplaceListVars($v);
        }
    }
		return $array;
	}
246569
protected static function prepareArrayLines(array $array)
    {
        $isAssoc = Arr::isAssoc($array);

        array_walk($array, function (&$value, $index, $withIndexes = false) {
            if (is_array($value)) {
                $value = self::formatArray($value);
            } else {
                $value = self::formatScalar($value);
            }

            if ($withIndexes) {
                $value = self::formatScalar($index) . ' => ' . $value;
            }
        }, $isAssoc);

        return $array;
    }
927971
public function ascii($array) {

		$ascii = '';

		foreach ($array as $utf8) {
			if ($utf8 < 128) {
				$ascii .= chr($utf8);
			} elseif ($utf8 < 2048) {
				$ascii .= chr(192 + (($utf8 - ($utf8 % 64)) / 64));
				$ascii .= chr(128 + ($utf8 % 64));
			} else {
				$ascii .= chr(224 + (($utf8 - ($utf8 % 4096)) / 4096));
				$ascii .= chr(128 + ((($utf8 % 4096) - ($utf8 % 64)) / 64));
				$ascii .= chr(128 + ($utf8 % 64));
			}
		}

		return $ascii;

	}
865763
public static function parseArrayToPg($array)
	{
		foreach ($array as $key => $value) {
			if (is_array($value)) {
				$array[$key] = self::parseArrayToPg($value);
			}
		}

		return '{' . implode(',', $array) . '}';
	}
920522
private static function limit($array) {
        $origin = $array;
        if(count($array) > 1) {
            self::calls(array_shift($array));
        }
        return ' LIMIT ' . $origin[0] . (intval($origin[1]) > 0 ? ', ' . $origin[1] : '');
    }
88836
public static function arrayClone(array $array)
    {
        return array_map(function ($element) {
                return ((is_array($element))
                    ? call_user_func(__FUNCTION__, $element)
                    : ((is_object($element))
                        ? clone $element
                        : $element
                    )
                );
        }, $array);
    }
1044584
public static function trimRecursive(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return [];
        }

        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::trimRecursive($value);

                continue;
            }

            if (is_string($value)) {
                $value = trim($value);
            }

            $result[$key] = $value;
        }

        return $result;
    }
1336247
public function quoteArr(array $array)
    {
        $result = array();

        foreach ($array as $key => $item) {
            $result[$key] = $this->quote($item);
        }

        return $result;
    }
1292277
public static function EncodePgArray(array $array) :string
        {
            $array = array_map(function (&$item) {
                if (is_array($item)) {
                    $item = self::EncodePgArray($item);
                }
                else if (is_null($item)) {
                    $item = "NULL";
                }
                else if (is_bool($item)) {
                    $item = $item ? 'true' : 'false';
                }
                else if (!is_integer($item) && !is_float($item)) {
                    $item = '"' . pg_escape_string($item) . '"';
                }

                return $item;
            }, $array);

            return "{" . implode(',', $array) . "}";
        }
1055647
private function trimArray(&$array)
    {
        foreach ($array as $key => $value) {
            if (is_string($value)) {
                $array[$key] = trim($value);
            } else if (is_array($value)) {
                $array[$key] = $this->trimArray($value);
            }
        }

        return $array;
    }
609680
public function join(array $array)
    {
        $function = $this->_function;
        $valuesFunction = $this->_valuesFunction;
        $result = '';
        foreach ($array as $key => $value) {
            if (!$this->_skipNulls || ($this->_skipNulls && $value)) {
                $result .= (
                    $function ? $function($key, $value) :
                        ($valuesFunction ? $valuesFunction($value) : $value)
                    ) . $this->_separator;
            }
        }
        return rtrim($result, $this->_separator);
    }
937880
protected function formatArrayAsYaml($array)
    {
        if (!(is_array($array) || !$array instanceof ArrayObject)) {
            return $array;
        }
        array_walk_recursive($array, function (&$item) {
            $item = is_object($item) ? get_class($item) : $item;
        });

        $yaml = Yaml::dump($array, 4, 2);

        return trim($yaml);
    }
841831
public function transform($array)
    {
        if (null === $array) {
            return '';
        }

        if (!is_array($array)) {
            throw new TransformationFailedException('Expected an array.');
        }

        foreach ($array as &$value) {
            $value = sprintf('%s%s%s',
                str_repeat(' ', $this->paddingLeft),
                $value,
                str_repeat(' ', $this->paddingRight)
            );
        }

        $string = trim(implode($this->delimiter, $array));

        return $string;
    }
615169
public static function tr($string, $array = array()) {
        if (is_string($string)) {
            $tr_arr = array();

            foreach ($array as $from => $to) {
                substr($from, 0, 1) !== ':' and $from = ':' . $from;
                $tr_arr[$from] = $to;
            }
            unset($array);

            return strtr($string, $tr_arr);
        } else {
            return $string;
        }
    }
682355
public static function pluck($array, $key)
    {
        return array_map(
            function ($v) use ($key) {
                return is_object($v) ? $v->$key : $v[$key];

            },
            $array
        );
    }
915423
public static function tryGetKeysChainValue($array)
    {
        $arguments = func_get_args();
        $numArguments = func_num_args();

        $currentArray = $array;
        for ($i = 1; $i < $numArguments; ++$i) {
            if (is_array($currentArray)) {
                if (array_key_exists($arguments[$i], $currentArray)) {
                    $currentArray = $currentArray[$arguments[$i]];
                } else {
                    return null;
                }
            } else {
                return null;
            }
        }

        return $currentArray;
    }