Russian \DateTime::format
@param array|\php_rutils\struct\TimeParams $params Params structure
@return string Date/time string representation
426440
public function ruStrFTime($params = null)
    {
        //Params handle
        if ($params === null) {
            $params = new TimeParams();
        } elseif (is_array($params)) {
            $params = TimeParams::create($params);
        } else {
            $params = clone $params;
        }

        if ($params->date === null) {
            $params->date = new \DateTime();
        } else {
            $params->date = $this->_processDateTime($params->date);
        }

        if (is_string($params->timezone)) {
            $params->timezone = new \DateTimeZone($params->timezone);
        }
        if ($params->timezone) {
            $params->date->setTimezone($params->timezone);
        }

        //Format processing
        $weekday = $params->date->format('N') - 1;
        $month = $params->date->format('n') - 1;

        $prepos = $params->preposition ? self::$_DAY_NAMES[$weekday][3] : '';

        $monthIdx = $params->monthInflected ? 2 : 1;
        $dayIdx = ($params->dayInflected || $params->preposition) ? 2 : 1;

        $search = array('D', 'l', 'M', 'F');
        $replace = array(
            $prepos.self::$_DAY_NAMES[$weekday][0],
            $prepos.self::$_DAY_NAMES[$weekday][$dayIdx],
            self::$_MONTH_NAMES[$month][0],
            self::$_MONTH_NAMES[$month][$monthIdx],
        );

        //for russian typography standard,
        //1 April 2007, but 01.04.2007
        if (strpos($params->format, 'F') !== false || strpos($params->format, 'M') !== false) {
            $search[] = 'd';
            $replace[] = 'j';
        }

        $params->format = str_replace($search, $replace, $params->format);

        //Create date/time string
        return $params->date->format($params->format);
    }
415748
protected function convertParamsToQuery(array $params)
    {
        $query = array();

        foreach ($params as $key => $val) {
            if (is_array($val)) {
                $val = implode(',', $val);
            } elseif ($val instanceof \DateTime) {
                $val = $val->format('Y-m-d');
            } elseif (is_bool($val)) {
                if ($val) {
                    $val = 1;
                } else {
                    continue;
                }
            } else {
                $val = urlencode($val);
            }
            $query[] = $key . '=' . $val;
        }

        return implode('&', $query);
    }
204239
protected function formatParameters(array $params)
    {
        $formatted = [];

        foreach ($params as $name => $value) {
            if (!in_array($name, ['member_count', 'room_limit', 'path', 'version_type'], true)) {
                continue;
            }

            if ('version_type' === $name && !in_array($value, ['develop', 'trial', 'release'], true)) {
                throw new InvalidArgumentException('Invalid value of attribute "version_type".');
            }

            $formatted[] = [
                'name' => $name,
                'value' => strval($value),
            ];
        }

        return $formatted;
    }
803826
public static function timestampToGermanDateFormat(int $timestamp): string {
        $dateTime = new \DateTime();
        $dateTime->setTimestamp($timestamp);
        $format = $dateTime->format(DateTimeUtil::GERMAN_DATE_TIME_FORMAT);
        return $format;
    }
457361
private function formatParams(array $params) {
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                $params[$key] = implode(',', $value);
            } else if (is_bool($value)) {
                $params[$key] = $value ? 1 : 0;
            }
        }
        return $params;
    }
1276598
private function formatSqlByParams(array $params)
    {
        if (empty($params)) {
            return;
        }
        foreach ($params as $key => $value) {
            $this->sql .= " $key=" . $value;
        }
    }
343655
public static function format($time = null, $format = 'Y-m-d H:i:s') {
		if (!empty($time) && !is_numeric($time)) {
			$format = $time;
			$time = time();
		}
		if (is_null($time)) {
			$time = time();
		}
		return date($format, $time);
	}
274677
public function fromUrl(string $param)
    {
        if ($this->checkDate($param)) {
            return new \DateTimeImmutable($param, $this->timezone);
        }

        throw $this->newInvalidFromUrl($param);
    }
1215613
private function _validateParameters ($params)
    {
        // 引数の有無
        if (! isset($params[0])) {
            throw new \Exception('生成するコマンド名を指定してください');
        }

        // 既に存在するかどうか
        $params[0] = ucfirst($params[0]);
        if (file_exists(GARNET.DS.'Command'.DS.$params[0].'.php')) {
            throw new \Exception($params[0].' コマンドは既に存在しています');
        }
    }
423957
public function path(array $params = array())
    {
        $this->build();
        
        $path = [];
        if ($this->_modules)
            $path = $this->_modules;
        $path[] = $this->_controller;
        $path[] = isset($params['action']) ? $params['action'] : $this->_action;
        
        $format = isset($params['format']) ? '.' . $params['format'] : '';
        
        return implode('/', $path) . $format;
    }
867602
protected function requestAnAccessToken($params = [])
    {
        $response = $this->sendRequestWithClientParams('/oauth/token', $params);
        $data = $response->getDecodedBody();

        if (!isset($data['access_token'])) {
            throw new SteeinSDKException('Токен ключ не был возвращен.', 401);
        }

        // Система oAuth возвращает два разных имени ключа для времени истечения
        $expiresAt = 0;

        if (isset($data['expires'])) {
            $expiresAt = time() + $data['expires'];
        } elseif (isset($data['expires_in'])) {
            // Время истечения в секундах будет возвращено как "expires_in".
            $expiresAt = time() + $data['expires_in'];
        }

        return new AccessToken($data['access_token'], $expiresAt);
    }
340016
protected function getHeader(array $params)
	{
		// Prepare the function's header
		$header = "/**\n";
		foreach ($params as $paramName => $paramType)
		{
			$header .= '* @param {' . $paramType . '} ' . $paramName . "\n";
		}
		$header .= "*/\n";

		return $header;
	}
5551
private function decorateParamsForMethodCall(array $params) : string
    {
        $params_out = [];
        foreach($params as $param) {
            $params_out[] = $this->decorateValue($param);
        }
        return implode(',',$params_out);
    }
145475
private function decodeParams($params)
    {
        if (is_string($params)) {
            $params = urldecode($params);
        } elseif (is_array($params)) {
            foreach ($params as &$currentParam) {
                $currentParam = $this->decodeParams($currentParam);
            }
        }

        return $params;
    }
1267215
protected function prepareParams(array $params)
    {
        $result = $params;

        foreach ($result as $key => $val) {
            if (is_bool($val)) {
                $result[$key] = $val ? 1 : 0;
            }
        }

        return $result;
    }
497639
public function somarDataFormatoBr($data, $dias=0, $meses=0, $anos=0, $horas=0, $mins=0, $segs=0)
    {
        $data = $this->converterParaDateTime($data, $this->FORMATO_DATA_BR);

        if (!$data){
            return '01/01/1900';
        }

        $data = explode('/', $data->format($this->FORMATO_DATA_BR));
        return date($this->FORMATO_DATA_BR, mktime($horas, $mins, $segs, $data[1] + $meses, $data[0] + $dias, $data[2] + $anos));
    }
198033
public static function format_string_parameters($stringparams) {
        // Check if there are some string params.
        $strparams = new stdClass();
        if (!empty($stringparams)) {
            // There is only one string parameter.
            if (count($stringparams) == 1) {
                $stringparam = array_pop($stringparams);
                if (isset($stringparam['name'])) {
                    $strparams->{$stringparam['name']} = $stringparam['value'];
                } else {
                    // It is a not named string parameter.
                    $strparams = $stringparam['value'];
                }
            }  else {
                // There are more than one parameter.
                foreach ($stringparams as $stringparam) {

                    // If a parameter is unnamed throw an exception
                    // unnamed param is only possible if one only param is sent.
                    if (empty($stringparam['name'])) {
                        throw new moodle_exception('unnamedstringparam', 'webservice');
                    }

                    $strparams->{$stringparam['name']} = $stringparam['value'];
                }
            }
        }
        return $strparams;
    }