Shortcut to render an array with borders

@param $array

@return string
775455
private static function __s_array($array)
    {
        $border    = new Border(Border::TYPE_FRAME);
        $structure = new Structure(Structure::TYPE_ARRAY, '', null, '|', $border);

        return static::buildStructure($array, $structure);
    }
1233399
protected function generateIniString($array)
    {
        $iniString = "";

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $iniString .= "[{$key}]".PHP_EOL;
                $iniString .= $this->generateIniString($value);
            } else {
                $iniString .= "{$key}={$value}".PHP_EOL;
            }
        }

        return $iniString;
    }
694096
protected static function TranslationArrayExport($array)
    {
        $output = "[\n";
        foreach ($array as $key => $value) {
            /**
             * Escape '
             */
            $key    = str_replace('\'', '\\\'', $key);
            $value  = str_replace('\'', '\\\'', $value);
            $output .= "\t'{$key}' => '{$value}',\n";
        }

        return $output . "];";
    }
1306342
private function formatThrowableObjects(array $array)
    {
        array_walk_recursive($array, function (&$value) {
            if ($value instanceof \Throwable) {
                try {
                    $value = serialize($value);
                } catch (\Throwable $throwable) {
                    $value = $this->formatThrowable($value);
                }
            }
        });

        return $array;
    }
631892
public static function escapeArray( $array )
    {
        $db = eZDB::instance();
        $out = array();
        foreach( $array as $key => $value )
        {
            if ( is_array( $value ) )
            {
                $tmp = array();
                foreach( $value as $valueItem )
                {
                    $tmp[] = $db->escapeString( $valueItem );
                }
                $out[$key] = $tmp;
                unset( $tmp );
            }
            else
                $out[$key] = $db->escapeString( $value );
        }
        return $out;
    }
929739
public function reverseTransform($array)
    {
        if ($this->reverseAsString && $this->fieldType == 'Tetranz\Select2EntityBundle\Form\Type\Select2EntityType') {
            $idArray = array();
            if (is_array($array) || $array instanceof \ArrayAccess) {
                foreach ($array as $elem) {
                    $idArray[] = (string) $elem->getId();
                }
            } else {
                if ($array) {
                    return $idArray[] = (string) $array->getId();
                }
            }

            if (array_key_exists(0, $idArray)) {
                return $idArray[0];
            } else {
                return '';
            }
        } else {
            // no reverse transformation required
            return $array;
        }
    }
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);
        }
    }
487492
private static function formatRequest(&$array)
    {
        if (!isset($array['buyer'])) {
            $array['buyer'] = array();
        }
        if (!isset($array['3DSecure'])) {
            $array['3DSecure'] = array();
        }
        if (!isset($array['bankAccountData'])) {
            $array['bankAccountData'] = array();
        }
        if (!isset($array['cancelURL']) || !strlen($array['cancelURL'])) {
            $array['cancelURL'] = null;
        }
        if (!isset($array['notificationURL']) || !strlen($array['notificationURL'])) {
            $array['notificationURL'] = null;
        }
        if (!isset($array['returnURL']) || !strlen($array['returnURL'])) {
            $array['returnURL'] = null;
        }
        if (!isset($array['languageCode']) || !strlen($array['languageCode'])) {
            $array['languageCode'] = null;
        }
        if (!isset($array['securityMode']) || !strlen($array['securityMode'])) {
            $array['securityMode'] = null;
        }
        if (!isset($array['billingAddress'])) {
            $array['billingAddress'] = array();
        }
        if (!isset($array['shippingAddress'])) {
            $array['shippingAddress'] = array();
        }
        if (!isset($array['owner'])) {
            $array['owner'] = array();
        }
        if (!isset($array['ownerAddress'])) {
            $array['ownerAddress'] = array();
        }
        if (!isset($array['contracts']) || !strlen($array['contracts'][0]) || !is_array($array['contracts'])) {
            $array['contracts'] = null;
        }
        if (!isset($array['secondContracts']) || !strlen($array['secondContracts'][0]) || !is_array($array['secondContracts'])) {
            $array['secondContracts'] = null;
        }
        if (!isset($array['walletContracts']) || !strlen($array['walletContracts'][0]) || !is_array($array['walletContracts'])) {
            $array['walletContracts'] = null;
        }
        if (!isset($array['customPaymentPageCode']) || !strlen($array['customPaymentPageCode'])) {
            $array['customPaymentPageCode'] = null;
        }
        if (!isset($array['customPaymentTemplateURL']) || !strlen($array['customPaymentTemplateURL'])) {
            $array['customPaymentTemplateURL'] = null;
        }
        if (!isset($array['recurring'])) {
            $array['recurring'] = array();
        }
        if (!isset($array['orderRef']) || !strlen($array['orderRef'])) {
            $array['orderRef'] = null;
        }
        if (!isset($array['orderDate']) || !strlen($array['orderDate'])) {
            $array['orderDate'] = null;
        }
        if (!isset($array['walletIds']) || !strlen($array['walletIds'][0] || !is_array($array['walletIds']))) {
            $array['walletIds'] = null;
        }
        if (!isset($array['merchantName'])) {
            $array['merchantName'] = null;
        }
        if (!isset($array['miscData'])) {
            $array['miscData'] = null;
        }
        if (!isset($array['subMerchant'])) {
            $array['subMerchant'] = array();
        }
        if (!isset($array['asynchronousRetryTimeout'])) {
            $array['asynchronousRetryTimeout'] = null;
        }
    }
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;
    }
409524
public function packMap(array $array)
    {
        $size = count($array);
        $b = '';
        $b .= $this->getMapSizeMarker($size);

        foreach ($array as $k => $v) {
            $b .= $this->pack($k);
            $b .= $this->pack($v);
        }

        return $b;
    }
575720
protected static function renderArgumentArray( $array )
	{
		$list	= array();
		foreach( $array as $key => $value )
		{
			$type	= self::renderArgumentType( $value );
			$string	= self::renderArgument( $value );
			$list[]	= UI_HTML_Tag::create( 'dt', $type." ".$key );
			$list[]	= UI_HTML_Tag::create( 'dd', $string );
		}
		$list	= UI_HTML_Tag::create( 'dl', implode( $list ) );
		$block	= UI_HTML_Tag::create( 'blockquote', $list );
		return '{'.$block.'}';
	}
615820
public function expandArray($array)
    {
        $retval = "";
        for ($i = 0; $i < count($array); $i++) {
            $retval .= $this->expandString($array[$i]);
        }

        return $retval;
    }
346257
public function render(array $array, string $key) {
    $result = null;

    if (is_array($array) && $key) {
      if (array_key_exists($key, $array)) {
        $result = $array[$key];
      }
    }

    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) . "}";
        }
229266
public static function array_strip_tags($array) {
    $result = array();

    foreach ( $array as $key => $value ) {
      $key = strip_tags($key);

      if (is_array($value)) {
        $result[$key] = self::array_strip_tags($value);
      } else if (is_numeric($value) && !preg_match('/^0\d+$/', $value)) {
        $result[$key] = $value + 0;
      } else {
        $result[$key] = htmlspecialchars(trim(strip_tags($value)), ENT_QUOTES | ENT_HTML5);
      }
    }

    return $result;
  }
1200967
protected function removeSlashes($array)
    {
        $fnc = function ($value) use (&$fnc) {
            if (is_array($value)) {
                return array_map($fnc, $value);
            }

            return stripslashes($value);
        };

        if (version_compare(phpversion(), '6.0.0-dev', '<') && get_magic_quotes_gpc()) {
            $array = array_map($fnc, $array);
        }

        return $array;
    }
728942
private function formatToParameters($array)
    {
        if (empty($array)) {
            return [];
        }

        $defaultDirection = config('columnsortable.default_direction', 'asc');

        if (is_string($array)) {
            return ['sort' => $array, 'direction' => $defaultDirection];
        }

        return (key($array) === 0) ? ['sort' => $array[0], 'direction' => $defaultDirection] : [
            'sort'      => key($array),
            'direction' => reset($array),
        ];
    }