Makes sure only allowed parameters are accepted, and merges them with the $params property.

@param  array $params Associative array containing image manipulation parameters
@return void
10507
protected function _setInputParams(array &$params) {
        foreach ($params as $paramKey => $paramValue) {
            if (in_array($paramKey, $this->args, true)
                && !is_null($paramValue)
            ) {
                $this->_inputParams[$paramKey] = $paramValue;
            }
        }

        $this->_params = array_merge($this->_params, $this->_inputParams);
    }
832269
public function setParamsSort(array $params) {
        if (is_numeric(key($params)) && key($params) == 0) {
            $tmp = [];
            foreach ($params as $key => $value) {
                $tmp[$key + 1] = $value;
            }
            $params = $tmp;
        }

        return $params;
    }
126409
private function validateAndSetBotParamsVital(array $params)
    {
        foreach (self::$valid_vital_bot_params as $vital_key) {
            if (!array_key_exists($vital_key, $params)) {
                throw new InvalidParamsException('Some vital info is missing: ' . $vital_key);
            }

            $this->bot_params[$vital_key] = $params[$vital_key];
        }
    }
226404
public function parseParams($allowedParams)
    {
        $this->allowedParams = $allowedParams;
        $this->setDefaultParams();

        foreach ($this->rawParams as $checkParam => $value) {
            if (! $paramOptions = $this->getParamOptions($checkParam)) {
                continue;
            }

            $param = $paramOptions['param'];
            $options = $paramOptions['options'];

            $paramValue = $this->getParamValue($param, $options, $value);
            if (isset($this->params[$param]) && is_array($this->params[$param])) {
                $this->params[$param] = array_merge($this->params[$param], $paramValue);
            } else {
                $this->params[$param] = $paramValue;
            }
        }
    }
466007
private function validateAndSetBotParamsSpecial(array $params)
    {
        // Special case, where secret MUST be defined if we have a webhook.
        if (($params['webhook']['url'] ?? null) && !($params['secret'] ?? null)) {
            // This does not apply when using CLI, but make sure it gets tested for!
            if ('cli' !== PHP_SAPI || BotManager::inTest()) {
                throw new InvalidParamsException('Some vital info is missing: secret');
            }
        }
    }
407878
public function addParams($params)
    {
        if (is_null($params)) {
            return;
        }

        if(!is_array($params)) {
            $params = array($params);
        }

        $this->params = array_merge($this->params, $params);
    }
134268
protected function serveBadSrc(array $params)
    {
        $width  = isset($params['width']) ? $params['width'] : 100;
        $height = isset($params['height']) ? $params['height'] : 100;
        $sError = isset($params['error']) ? $params['error'] : '';

        //  Make sure this doesn't get cached
        $this->unsetCacheHeaders();

        // --------------------------------------------------------------------------

        //  Create the icon
        if ($this->isRetina) {
            $icon = @imagecreatefrompng($this->cdnRoot . '_resources/img/fail@2x.png');
        } else {
            $icon = @imagecreatefrompng($this->cdnRoot . '_resources/img/fail.png');
        }
        $iconW = imagesx($icon);
        $iconH = imagesy($icon);

        // --------------------------------------------------------------------------

        //  Create the background
        $bg    = imagecreatetruecolor($width, $height);
        $white = imagecolorallocate($bg, 255, 255, 255);
        imagefill($bg, 0, 0, $white);

        // --------------------------------------------------------------------------

        //  Merge the two
        $centerX = ($width / 2) - ($iconW / 2);
        $centerY = ($height / 2) - ($iconH / 2);
        imagecopymerge($bg, $icon, $centerX, $centerY, 0, 0, $iconW, $iconH, 100);

        // --------------------------------------------------------------------------

        //  Write the error on the bottom
        if (!empty($sError)) {
            $textcolor = imagecolorallocate($bg, 0, 0, 0);
            imagestring($bg, 1, 5, $height - 15, 'ERROR: ' . $sError, $textcolor);
        }

        // --------------------------------------------------------------------------

        //  Output to browser
        $oInput = Factory::service('Input');
        header('Content-Type: image/png', true);
        header($oInput->server('SERVER_PROTOCOL') . ' 400 Bad Request', true, 400);
        imagepng($bg);

        // --------------------------------------------------------------------------

        //  Destroy the images
        imagedestroy($icon);
        imagedestroy($bg);

        // --------------------------------------------------------------------------

        /**
         * Kill script, th, th, that's all folks.
         * Stop the output class from hijacking our headers and
         * setting an incorrect Content-Type
         **/

        exit(0);
    }
862052
public function setGetParams($params)
    {
        // We consider the array is a GET array.
        if(!is_array($params)) {
            $params = explode('&', str_replace('?', '', $params));
        }

        $get = array();
        foreach($params as $varname => $varval) {
            if($varname == 'p') continue; // We don't want to specify the page twice!
            if(is_array($varval)) {
                foreach($varval as $subval) {
                    $get[] = "${varname}[]=$subval";
                }
            } else {
                $get[] = "$varname=$varval";
            }
        }
        $this->getparams = implode('&', $get);
    }
1069814
public function configureEvent(array $params = []) : void
    {
        $params = array_merge($this->defaultParams, $params);
        foreach ($params as $name => $value) {
            $method = 'set' . ucfirst((string)$name);
            if (method_exists($this, $method) && is_callable([$this, $method])) {
                $this->$method($value);
            }
        }
    }
1031283
public function setParams(array $params)
    {
        // Is this an associative array?
        if (!empty($params)) {
            if (\count(array_filter(array_keys($params), '\is_string')) < 1) {
                throw new ParseIncludesException('Parameters must be an associative array indexed by key');
            }
        }
        $this->params = $params;

        return $this;
    }
1140473
protected function parseFields($params)
    {
        foreach (explode(',', $params) as $field) {
            // Only add the fields that are on the base resource
            if (! Str::contains($field, '.')) {
                $this->fields[] = trim($field);
            } else {
                $this->additionalFields[] = trim($field);
            }
        }
    }
160066
protected function serializeParams(array $params)
    {
        $serialized = array();
        foreach ($params as $param) {
            $serialized[] = $this->serializer->serialize($param);
        }

        return $serialized;
    }
257504
private function prepareParametersUrl(array $params, array $allowedParams)
    {
        $allowedParams = array_flip($allowedParams);
        $params = array_intersect_key($params, $allowedParams);

        $paramsUrlItems = [];
        foreach ($params as $key => $param) {
            $paramsUrlItems[] = $key . '=' . urlencode($param);
        }

        $paramsUrl = join('&', $paramsUrlItems);
        if (strlen($paramsUrl) > 0) {
            $paramsUrl = '?' . $paramsUrl;
        }

        return $paramsUrl;
    }
1000757
private function validateAndSetBotParams(array $params): self
    {
        $this->validateAndSetBotParamsVital($params);
        $this->validateAndSetBotParamsSpecial($params);
        $this->validateAndSetBotParamsExtra($params);

        return $this;
    }
395202
protected function cleanParams(array $params)
    {
        $values = [];
        foreach ($params as $name => $details) {
            $this->cleanValueFrom($name, $details['value'], $values);
        }

        return $values;
    }
713378
public function setParams(array $params)
    {
        foreach ($params as $param) {
            $this->config->setEndpoint(
                str_replace('{' . $param['placeholder'] . '}', $param['value'], $this->config->getConfig()['endpoint'])
            );
        }

        $this->parentParams = $params;
    }
412885
public function imageSave($params)
    {
        if (is_array($params)) {
            imagejpeg($params['image'], $params['target'], 100);
            imagedestroy($params['image']);

            return true;
        } else {
            return false;
        }
    }