Saving initial params.

@param array $params
@return $this
551685
private function saveInputParams($params){
		foreach($params as $param => $value){
			$var = "_" . $param;

			if(!isset($this->{$var}) || !is_null($this->{$var})){
				$this->{$var} = $value;
			}
		}

		return $this;
	}
469031
public function save($params = array()) {
        global $DB;

        // Sort out criteria description.
        // If it is coming from the form editor, it is an array of (text, format).
        $description = '';
        $descriptionformat = FORMAT_HTML;
        if (isset($params['description']['text'])) {
            $description = $params['description']['text'];
            $descriptionformat = $params['description']['format'];
        } else if (isset($params['description'])) {
            $description = $params['description'];
        }

        $fordb = new stdClass();
        $fordb->criteriatype = $this->criteriatype;
        $fordb->badgeid = $this->badgeid;
        $fordb->description = $description;
        $fordb->descriptionformat = $descriptionformat;
        if ($this->id !== 0) {
            $fordb->id = $this->id;
            $DB->update_record('badge_criteria', $fordb);
        } else {
            // New record in DB, set aggregation to ALL by default.
            $fordb->method = BADGE_CRITERIA_AGGREGATION_ALL;
            $DB->insert_record('badge_criteria', $fordb);
        }
    }
181775
public function initialize(array $parameters = [])
        {
            if (null !== $this->response) {
                throw new RuntimeException('Request cannot be modified after it has been sent!');
            }

            $this->helper->initialize($this, $parameters);

            return $this;
        }
707395
public function params($params = null)
    {
        if (null !== $params) {
            $this->params = $params;

            return $this;
        }

        return $this->params;
    }
49019
final public function bind(array $params = array())
	{
		$params = $this->bindConversion($params);
		array_map(
			[$this, 'bindParam'],
			array_keys($params),
			array_values($params)
		);

		return $this;
	}
820345
public function withQueryParams($params)
    {
        while (list($key, $value) = each($params)) {
            $this->queryParams[$key] = $value;
        }

        return $this;
    }
611051
public function params(...$params): self
    {
        $this->params = $params;
        array_push($this->params, $this->event);
        return $this;
    }
613805
public static function create(array $params = [])
    {
        $headers = new static();
        foreach ($params as $key => $value) {
            $headers->set($key, $value);
        }
        return $headers;
    }
1102828
protected function _save(array $params = []) {
		$params['path'] = Inflector::underscore($this->request->action);
		$params['file'] = $this->request->args(0);

		$contents = $this->_template();
		$result = Text::insert($contents, $params);

		if (!empty($this->_library['path'])) {
			$path = $this->_library['path'] . "/views/{$params['path']}/{$params['file']}";
			$file = str_replace('//', '/', "{$path}.php");
			$directory = dirname($file);

			if (!is_dir($directory)) {
				if (!mkdir($directory, 0755, true)) {
					return false;
				}
			}
			$directory = str_replace($this->_library['path'] . '/', '', $directory);
			if (file_exists($file)) {
				$prompt = "{$file} already exists. Overwrite?";
				$choices = ['y', 'n'];
				if ($this->in($prompt, compact('choices')) !== 'y') {
					return "{$params['file']} skipped.";
				}
			}
			if (is_int(file_put_contents($file, $result))) {
				return "{$params['file']}.php created in {$directory}.";
			}
		}
		return false;
	}
1355464
public function addParams(array $params): self
    {
        foreach ($params as $name => $value) {
            $this->addParam($name, $value);
        }

        return $this;
    }
471132
public function withPost(array $params)
    {
        $request = $this;
        if ($this->isJson()) {
            $body = json_encode($params);
        } else {
            $body = http_build_query($params);
            if (!$this->hasHeader('Content-Type')) {
                $request = $this->withHeader('Content-Type', 'application/x-www-form-urlencoded');
            }
        }

        return new self(
            $request->getMethod(),
            $request->getUri(),
            $request->getHeaders(),
            $body,
            $request->getProtocolVersion(),
            $request->getRetries(),
            $request->getOptions(),
            $this->getServiceKey(),
            $this->getRequestKey()
        );
    }
634382
public function save(array $params = [])
    {

        $index      = array_get($params, 'index');
        $visibility = array_get($params, 'visible');
        $key        = array_get($params, 'key');

        if (is_null($index) or is_null($visibility) or is_null($key)) {
            return false;
        }
        $request = request();
        $session = $request->session();

        if ($session->has($key)) {
            $data         = $session->get($key);
            $data[$index] = $visibility === "true";
            $session->remove($key);
        } else {
            $data = [$index => $visibility === "true"];
        }
        $session->put($key, $data);
        $session->save();
        return $data;
    }
865212
public function setParams(array $params = [])
    {
        if (isset($params['access_token'])) {
            $this->setAccessTokenFromParams($params['access_token']);
        }

        unset($params['access_token']);

        $params = $this->sanitizeFileParams($params);
        $this->dangerouslySetParams($params);

        return $this;
    }
539602
public function remove($params = [])
    {
        $this->params = array_diff_key($this->params, array_fill_keys($params, ''));
        return $this;
    }
913116
protected function setParams(array $params) {
		parent::setParams($params);
		if($this->autoinc===true){
			$this->notNull=false;
		}
	}
1251274
public function addMultipartParams( $params ) {
		$this->checkMultipartParams( $params );
		$this->multipartParams = array_merge( $this->multipartParams, $params );
		return $this;
	}
876418
public function addParamsNavStart($params = [])
    {
        if (is_array($params) && !empty($params))
        {
            $this->navStartParams = array_merge(is_array($this->navStartParams) ? $this->navStartParams : array(), $params);
        }
    }