Transforms dateArray (2 dates) to a string.

@param array|null $dateArray

@return string
331396
public function transform($dateArray)
    {
        $startDate = time();
        $endDate = time();
        if ($dateArray != null) {
            if (array_key_exists(0, $dateArray)) {
                $startDate = $dateArray[0];
            }
            if (array_key_exists(1, $dateArray)) {
                $endDate = $dateArray[1];
            }

            $format = $this->translator->trans('date_range.format', array(), 'platform');
            $separator = $this->translator->trans('date_range.separator', array(), 'platform');
            $outputValue = date($format, $startDate).' '.$separator.' '.date($format, $endDate);
            if ($startDate == $endDate) {
                $outputValue = date($format, $startDate);
            }

            return $outputValue;
        }
    }
1370423
public function _transform(array $array = null)
    {
        if (empty($array)) return;


        foreach ($array as $param) {
            if (strpos($param, '=') > 0) {
                $tmp           = explode(Generic::ASSIGNMENT_OPERATOR, $param);
                $this->$tmp[0] = $tmp[1];
            }
        }

        return;
    }
1185387
public function getDataPlainText(array $dataSubArray): string
    {
        $dataArray = [];
        foreach ($dataSubArray as $key => $value) {
            $dataArray[] = implode($this->config->getDataSubSeparator(), [$key, $value]);
        }

        return implode($this->config->getDataSeparator(), $dataArray);
    }
1317560
public static function fromResponseArray($responseArray)
    {
        if (!is_array($responseArray)) {
            throw new \InvalidArgumentException(
                'Argument is not array'
            );
        }
        if (!isset($responseArray['access_token'])) {
            throw new \InvalidArgumentException(
                'Access token is not available'
            );
        }
        if (!isset($responseArray['expires_in'])) {
            throw new \InvalidArgumentException(
                'Access token expiration date is not specified'
            );
        }
        return new static(
            $responseArray['access_token'],
            $responseArray['expires_in'] + time()
        );
    }
1230661
public function to_query_string($array)
	{
		$temp = array();

		foreach ($array as $key => $value)
		{
			if (is_string($key) && !is_array($value))
			{
				$temp[] = rawurlencode($key) . '=' . rawurlencode($value);
			}
		}

		return implode('&', $temp);
	}
1169297
public function date($date=null)
    {
        if(is_null($date)) {
            $date = $this->created_at;
        }
        return String::date($date);
    }
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;
        }
    }
693262
public static function keyedArray($array) {
        if(is_array($array)) {
            $string = '[ ';
            foreach($array as $key => $item) {
                if(!is_string($item)) {
                    $item = self::keyedArray($item);
                }
                $string .= $key . ' => ' . $item;
                if($item !== last($array)) {
                    $string .= ', ';
                }
            }
            $string .= ' ]';

            return $string;
        } else {
            if(is_object($array)) {
                return get_class($array);
            } else {
                if(is_null($array)) {
                    return 'Null';
                } else {
                    return 'Unknown';
                }
            }
        }
    }
89944
private function formatDataForChart(array $data, \DateTime $minDate = null, \DateTime $maxDate = null)
    {
        $prevDate = $minDate;
        $chartData = [];
        $idx = 0;
        foreach ($data as $value) {
            // Fill in with zeros from previous date till this date
            while ($prevDate !== null && $prevDate < $value['date']) {
                $chartData["c${idx}"] = ['xData' => $prevDate->format('Y-m-d\TH:i:s'), 'yData' => 0];
                $prevDate->add(new \DateInterval('P1D'));
                ++$idx;
            }
            $chartData["c${idx}"] = ['xData' => $value['date']->format('Y-m-d\TH:i:s'), 'yData' => floatval($value['total'])];
            $prevDate = $value['date']->add(new \DateInterval('P1D'));
            ++$idx;
        }
        // Fill in with zeros till maxDate
        while ($prevDate !== null && $maxDate !== null && $maxDate >= $prevDate) {
            $chartData["c${idx}"] = ['xData' => $prevDate->format('Y-m-d\TH:i:s'), 'yData' => 0];
            $prevDate->add(new \DateInterval('P1D'));
            ++$idx;
        }

        return $chartData;
    }
129486
public static function toString($dayOfWeek)
    {
        return isset(self::$strings[$dayOfWeek]) ? self::$strings[$dayOfWeek] : null;
    }
637915
static public function daysBetweenDates(string $date1, string $date2):? int
    {
        // If input dates have datetime 'Y-m-d X' format, take only the date part
        list($d1) = array_pad(explode(' ', $date1), 1, 0);
        list($d2) = array_pad(explode(' ', $date2), 1, 0);

        if (!self::checkDate($d1) || !self::checkDate($d2)) {
            return null;
        }

        if (!($dates = self::splitDates($d1, $d2))) {
            return null;
        }

        return (count($dates) - 1);
    }
162877
private String stringArray2String(String[] array) {
        StringBuilder sb = new StringBuilder("");
        for (int i = 0 ; i<array.length ; i++) {
            sb.append(array[i]);
            if (i<array.length - 1)
                sb.append("\n");
        }
        return sb.toString();
    }
1227775
private function toStrings($values)
    {
        foreach ($values as &$value) {
            if ($value instanceof \Datetime) {
                $value = $value->format('Y-m-d H:i:s');
            } elseif ($value) {
                $value = (string) $value;
            }
        }

        return $values;
    }
166149
protected function date_format($date)
    {
        if (empty($date)) {
            return null;
        }

        if (!is_object($date) || !is_a($date, 'DateTime')) {
            try {
                $timestamp = rcube_utils::strtotime($date);
                $date      = new DateTime("@".$timestamp);
            }
            catch (Exception $e) {
                return null;
            }
        }

        return $date->format('d-M-Y H:i:s O');
    }
825570
public function transform(array $array): string
    {
        return json_encode(
            $array,
            JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_FORCE_OBJECT | JSON_PRETTY_PRINT |
            JSON_UNESCAPED_SLASHES
        );
    }
1057437
public function serializePHP($array)
    {
        $raw = '';
        $line = 0;
        $keys = array_keys($array);

        foreach ($keys as $key) {
            $value = $array[$key];
            $line++;
            $raw .= $key . '|';
            if (is_array($value) && isset($value['huge_recursion_blocker_we_hope'])) {
                $raw .= 'R:' . $value['huge_recursion_blocker_we_hope'] . ';';
            } else {
                $raw .= serialize($value);
            }
            $array[$key] = array('huge_recursion_blocker_we_hope' => $line);
        }

        return $raw;
    }
77052
function _formatAuthor($array)
    {
        if (!array_key_exists('von', $array)) {
            $array['von'] = '';
        } else {
            $array['von'] = trim($array['von']);
        }
        if (!array_key_exists('last', $array)) {
            $array['last'] = '';
        } else {
            $array['last'] = trim($array['last']);
        }
        if (!array_key_exists('jr', $array)) {
            $array['jr'] = '';
        } else {
            $array['jr'] = trim($array['jr']);
        }
        if (!array_key_exists('first', $array)) {
            $array['first'] = '';
        } else {
            $array['first'] = trim($array['first']);
        }
        $ret = $this->authorstring;
        $ret = str_replace("VON", $array['von'], $ret);
        $ret = str_replace("LAST", $array['last'], $ret);
        $ret = str_replace("JR,", $array['jr'], $ret);
        $ret = str_replace("FIRST", $array['first'], $ret);

        return trim(print_r($ret, 1));
    }