Converts links in an array from relative to absolute

@param array $array Source array
173056
protected function _processLinks(array &$array)
    {
        $base = $this->getUrl()->toString(KHttpUrl::AUTHORITY);

        foreach ($array as $key => &$value)
        {
            if (is_array($value)) {
                $this->_processLinks($value);
            }
            elseif ($key === 'href')
            {
                if (substr($value, 0, 4) !== 'http') {
                    $array[$key] = $base.$value;
                }
            }
            elseif (in_array($key, $this->_text_fields)) {
                $array[$key] = $this->_processText($value);
            }
        }
    }
1028884
public static function arrayFlatten($array)
    {
        $flatten = array();
        foreach ($array as $key => $inner) {
            if (is_array($inner)) {
                foreach ($inner as $inner_key => $value) {
                    $flatten[$inner_key] = $value;
                }
            } else {
                $flatten[$key] = $inner;
            }
        }

        return $flatten;
    }
1000662
public static function trim_array($array)
    {

        if (empty($array) || !is_array($array)) return $array;

        foreach ($array as $key => $value) {
            $array[$key] = trim($value);
        }

        unset($key, $value);

        return $array;
    }
1040289
private function phpEncodeArray(array $array)
    {
        $isPlainArray = function (array $value) {
            return ((count($value) === 0)
                || (
                    (array_keys($value) === range(0, count($value) - 1))
                    && (0 === count(array_filter(array_keys($value), 'is_string'))))
            );
        };

        if ($isPlainArray($array)) {
            return '['.implode(', ', array_map([$this, 'phpEncodeValue'], $array)).']';
        }

        return '['.implode(', ', array_map(function ($key) use ($array) {
            return $this->phpEncodeValue($key).' => '.$this->phpEncodeValue($array[$key]);
        }, array_keys($array))).']';
    }
1314728
public function copyFromArray(array &$array)
    {
        // sns
        $this->setSns(
            Sns::valueOf(
                LanguageUtility::getFromArray('sns', $array)));

        // apiKey
        $this->setApiKey(
            LanguageUtility::getFromArray('apiKey', $array));

        // apiSecret
        $this->setApiSecret(
            LanguageUtility::getFromArray('apiSecret', $array));
    }
910332
private function flatten(array $array)
    {
        $single = array();
        if (isset($array['hier'])) {
            unset($array['hier']);
        }
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                foreach ($this->flatten($value) as $key => $value) {
                    $single[$key] = $value;
                }
            } else {
                $single[$key] = $value;
            }
        }

        return $single;
    }
898735
public static function pivotFromTwoDimension(&$array)
    {
        foreach ((array) $array as $val) {
            if (is_array($val) || is_object($val)) {
                foreach ((array) $val as $key => $val2) {
                    $array = Arr::set($array, $key, $val2);
                }
            }
        }

        return $array;
    }
640184
static public function toLowerCaseKey(array $array)
	{
	    $res = [];
	    if ($array) {
	        foreach ($array as $k  => $v) {
	            if (is_array($v)) {
	                $v = static::toLowerCaseKey($v);
	            }
	            $res[strtolower($k)] = $v;
	        }
	    }
	    return $res;
	}
649750
public function arrayToUnorderedList(array $array): string
    {
        $out = '<ul>';
        foreach ($array as $key => $elem) {
            if (!is_array($elem)) {
                $out = $out . "<li><span>{$key}: " . h($elem) . '</span></li>';
            } else {
                $out = $out . "<li><span>{$key}</span>" . $this->arrayToUnorderedList($elem) . '</li>';
            }
        }
        $out .= '</ul>';

        return $out;
    }
664273
public function setLinks(array $links)
    {
        foreach ($links as &$href) {
            $href = ['href' => $href];
        }

        $this->links = $links;
    }
157566
public static function flatten(array $array)
    {
        $out = [];

        foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key => $item) {
            if (is_int($key)) {
                $out[] = $item;
            } else {
                $out[$key] = $item;
            }
        }

        return $out;
    }
1093868
static public function stringify(array $array)
    {
        $result = array();
        foreach ($array as $key => $value) {
            $result[] = sprintf('%s=%s', $key, $value);
        }
        return implode('&', $result);
    }
1065925
public static function filterArray($array)
    {
        if (!is_array($array))
        {
            return false;
        }

        $clean = array();
        foreach ($array as $key => $string)
        {
            if (is_array($string))
            {
                self::filterArray($string);
            }
            else
            {
                $string = self::escape($string);
                $key = self::escape($key);
            }
            $clean[$key] = $string;
        }
        return $clean;
    }
1109779
private
    function mapping(&$array)
    {
        foreach ($array as $key => &$item) {
            if ($key[0] == '@' || strpos($key, '_') === 0 || $key == 'dynamic_templates') {
                unset($array[$key]);
                continue;
            }
            if ($key == 'properties') {
                unset($array[$key]);
                $array = array_merge($array, $item);
                $this->mapping($array);
                continue;
            }
            if (is_array($item)) {
                if ($item['type']) {
                    $item = $item['type'];
                } else
                    $this->mapping($item);
            }
        }
    }
231500
public function copyToArray(array &$array)
    {
        $array['grantType']            = LanguageUtility::toString($this->grantType);
        $array['clientId']             = LanguageUtility::orZero($this->clientId);
        $array['subject']              = $this->subject;
        $array['scopes']               = $this->scopes;
        $array['accessTokenDuration']  = LanguageUtility::orZero($this->accessTokenDuration);
        $array['refreshTokenDuration'] = LanguageUtility::orZero($this->refreshTokenDuration);
        $array['properties']           = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
        $array['clientIdAliasUsed']    = $this->clientIdAliasUsed;
        $array['accessToken']          = $this->accessToken;
        $array['refreshToken']         = $this->refreshToken;
    }
971829
public function flatten(array $array)
    {
        $return = [];
        foreach ($array as $key => $value) {
            if (in_array($key, $this->exceptions)) {
                $return[$key] = $value;
            } else {
                $return[] = $value;
            }
        }

        return $return;
    }
656206
protected function fromArray(array $array)
    {
        if (is_array($array)) {
            foreach ($array as $index => $element) {
                if (is_array($element)) {
                    $this->xmlWriter->startElement($index);
                    $this->fromArray($element);
                    $this->xmlWriter->endElement();
                } else {
                    $this->xmlWriter->startElement($index);
                    $this->xmlWriter->text($element);
                    $this->xmlWriter->endElement();
                }
            }
        }
    }