Parse given format and fill it's placeholders with params.

@param ...mixed $params parameters used to format given string

@return Transformer
968733
public function compile()
    {
        $params = (\func_num_args() > 0 ? \func_get_args() : $this->params);

        $compiler = new Compiler($this->format, $params, Compiler::MODE_INDEXED);

        return new Transformer($compiler);
    }
987371
public static function transformer(TransformerInterface $transformer, array $params): array
    {
        if (empty($params)) {
            return $params;
        }

        try {
            list($extra, $variadic) = self::interpretFunction(
                new \ReflectionMethod($transformer, 'transform'),
                $params
            );

            list($args) = self::interpretFunction(
                new \ReflectionMethod($transformer, '__invoke'),
                $params
            );

            return array_merge(
                $args,
                $extra,
                $variadic
            );
        } catch (\ReflectionException $e) {
            // Sorry
        }

        return [];
    }
1294939
public function transformParams(array $params): array
    {
        $newParams = [];
        foreach ($params as $key => $value) {
            $newParams['%' . $key . '%'] = $value;
        }

        return $newParams;
    }
823612
private function validateParameters(array $params) {
        if (empty($params['width']) || empty($params['height'])) {
            throw new TransformationException('Both width and height needs to be specified', 400);
        }

        // Get POI from transformation params
        $poi = empty($params['poi']) ? null : explode(',', $params['poi']);

        // Check if we have the POI in metadata
        if (!$poi) {
            $metadataPoi = $this->getPoiFromMetadata();

            if ($metadataPoi) {
                $poi = $metadataPoi;
            }
        }

        if ($poi) {
            if (!isset($poi[0]) || !isset($poi[1])) {
                throw new TransformationException('Invalid POI format, expected format `<x>,<y>`', 400);
            }

            if (!empty($params['crop']) && in_array($params['crop'], ['close', 'medium', 'wide']) === false) {
                throw new TransformationException('Invalid crop value. Valid values are: close,medium,wide', 400);
            }
        }

        $params['closeness'] = (isset($params['crop']) ? $params['crop'] : 'medium');
        $params['poi'] = $poi;

        return $params;
    }
458597
public function loadParams(array $params)
    {
        $this->arguments = array();
        $this->options = array();

        foreach ($params as $param) {
            if (strpos($param, '-') !== false) {
                $this->options[] = $this->extractOption($param);
            } else {
                $this->arguments[] = $param;
            }
        }

        return $this;
    }
318595
public function setParams($params)
		{
			$this->params = [];
			foreach ($params as $param)
			{
				// variables
				$name = $param['name'];
				$type = $param['type'];
				$value = $param['value'];

				// properties
				$this->params[$name] = $this->convert($type, $value);
			}

			// return
			return $this;
		}
806472
protected function normalizeParams(array $params) {
		$processed = [];
		
		foreach ($params as $param => $value) {
			$processed[sprintf($this->paramsPattern, $param)] = $value;
		}
		
		return $processed;
	}
1252935
private function parseParameter(string $key, string $value, &$params): string
    {
        if (isset($params[$key])) {
            $par = $params[$key];
            unset($params[$key]);

            $value = $value ? $value . '_' . $par : $par;
        }

        return static::makeParam($key, $value);
    }
5551
private function decorateParamsForMethodCall(array $params) : string
    {
        $params_out = [];
        foreach($params as $param) {
            $params_out[] = $this->decorateValue($param);
        }
        return implode(',',$params_out);
    }
310207
protected function parseSort($params)
    {
        foreach (explode(',', $params) as $sort) {
            // Check if ascending or descending(-) sort
            if (preg_match('/^-.+/', $sort)) {
                $direction = 'desc';
            } else {
                $direction = 'asc';
            }

            $sort = preg_replace('/^-/', '', $sort);
            if (! $this->canSort($sort)) {
                return;
            }

            // Only add the sorts that are on the base resource
            if (! Str::contains($sort, '.')) {
                $this->getHandler()->orderBy($sort, $direction);
            } else {
                $this->additionalSorts[$sort] = $direction;
            }
        }
    }
1249147
protected function _parseApiParams($params)
  {
    $apiparams = [];
    if (count($params) === 0) {
      return $apiparams;
    }

    if (is_array($params[0])) {
      // given parameters are array
      $apiparams = $params[0];
      return $apiparams;
    }

    // user gave us query-style params
    parse_str($params[0], $apiparams);
    if (! is_array($apiparams)) {
      $apiparams = [];
    }

    return $apiparams;
  }
1276598
private function formatSqlByParams(array $params)
    {
        if (empty($params)) {
            return;
        }
        foreach ($params as $key => $value) {
            $this->sql .= " $key=" . $value;
        }
    }
146526
public function setFormat($format, $placeholder = NULL)
	{
		$this->format = $format;

		if ($placeholder === NULL) {
			$placeholder = self::makeFormatPlaceholder($format);
		}
		if (!empty($placeholder)) {
			$this->setPlaceholder($placeholder);
		}

		return $this;
	}
429660
protected function doRequest($params, $answerFormat = ConnectorInterface::ANSWER_FORMAT_ARRAY)
    {
        $data = [
            'method' => $this->method,
            'params' => $params
        ];

        return $this->connector->doRequest($this->apiName, $data, $answerFormat);
    }
955385
protected static function formatParams($params)
    {
        $reslt = '';
        //
        for ($i = 0; $i < count($params); $i++) {
            $reslt .= '$'.$params[$i];
            if ($i < count($params) - 1) {
                $reslt .= ',';
            }
        }

        return $reslt;
    }
163611
protected function prepareParams($params)
    {
        if (isset($params['dsn'])) {
            $params['dsn'] = str_replace('oracle:', 'oci:', $params['dsn']);
        }

        return parent::prepareParams($params);
    }
1195495
public static function parse($params = [])
	{
		$obj = new Body();

		foreach( (array) $params['vars'] as $item )
		{
			$obj->setVar($item['name'], $item['value']);
		}

		foreach( (array) $params['requests'] as $item )
		{
			$obj->setRequest($item);
		}

		return $obj;
	}