@param array|null $params
@param array|string|null $options

@deprecated Use the `save` method on the Dispute object

@return array The updated dispute.
3457
public function updateDispute($params = null, $options = null)
    {
        $url = $this->instanceUrl() . '/dispute';
        list($response, $opts) = $this->_request('post', $url, $params, $options);
        $this->refreshFrom(['dispute' => $response], $opts, true);
        return $this->dispute;
    }
537527
public function getUpdates(array $params = [])
    {
        return array_map(function (stdClass $update) {
            return Update::create($update);
        }, $this->request('getUpdates', $params)->getResult());
    }
937092
public function post($params = array(), $options = array())
	{
		// If its an array (instead of a query string) then format it correctly
		if (is_array($params))
		{
            if($this->format == "json"){
                $params = json_encode($params);
            }else{
                if(!empty($_FILES)){
                    foreach($_FILES as $fileField => $fileVal){
                        $params[$fileField] = curl_file_create($fileVal['tmp_name'], $fileVal['type'], $fileVal['name']);
                    }
                }else{
					$params = http_build_query($params, NULL, '&');
				}
            }
		}

		// Add in the specific options provided
		$this->options($options);

		$this->http_method('post');

		$this->option(CURLOPT_POST, TRUE);
		$this->option(CURLOPT_POSTFIELDS, $params);
	}
975268
public static function all($params = null, $opts = null)
    {
        self::_validateParams($params);
        $url = static::classUrl();

        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
        if (!is_a($obj, 'Stripe\\Collection')) {
            $class = get_class($obj);
            $message = "Expected type \"Stripe\\Collection\", got \"$class\" instead";
            throw new \Stripe\Error\Api($message);
        }
        $obj->setLastResponse($response);
        $obj->setRequestParams($params);
        return $obj;
    }
829869
public function saveIfExistsOrFail(array $options = []): bool
    {
        if ($this->exists === false) {
            return false;
        }

        return $this->saveOrFail($options);
    }
1085559
private function SaveOptions(array $options)
    {
        $prev = null;
        foreach ($options as $value=>$text)
        {
            $option = new SelectOption();
            $option->SetSelectField($this->select);
            $option->SetPrevious($prev);
            $option->SetText($text);
            $option->SetValue($value);
            $option->Save();
            $prev = $option;
        }
    }
369867
public static function update($sub_app_id, $params, $options = null)
    {
        $url = static::instanceUrlWithId($sub_app_id);
        return static::_directRequest('put', $url, $params, $options);
    }
285922
public function save($options = array())
    {

        if ($this->isEmbed()) {
            return false;
        }

        $this->processReferencesChanged();
        $this->processEmbedsChanged();

        /* if no changes then do nothing */

        if ($this->_exist && empty($this->dirtyData) && empty($this->unsetData)) return true;

        $this->__preSave();

        if ($this->_exist) {
            $this->__preUpdate();
            $updateQuery = array();

            if (!empty($this->dirtyData)) {
                $updateQuery['$set'] = self::mapFields($this->dirtyData);
            };

            if (!empty($this->unsetData)) {
                $updateQuery['$unset'] = self::mapFields($this->unsetData);
            }

            $success = $this->_connection->update($this->collectionName(), array('_id' => $this->getId()), $updateQuery, $options);
            $this->__postUpdate();

        } else {
            $this->__preInsert();
            $data = self::mapFields($this->cleanData);
            $insert = $this->_connection->insert($this->collectionName(), $data, $options);
            $success = !is_null($this->cleanData['_id'] = $insert['_id']);
            if ($success) {
                $this->_exist = true ;
                $this->__postInsert();
            }

        }

        $this->dirtyData = array();
        $this->unsetData = array();
        $this->__postSave();

        return $success;

    }
1120174
public static function confirm($params = null, $options = null)
    {
        $params['status'] = 'pending';
        return self::_create($params, $options);
    }
65685
public function export_data( $params = null ) {

		$defaults = array(
			'fields' => null,
			'depth'  => 2,
			'params' => null,
		);

		if ( empty( $params ) ) {
			$params = $defaults;
		} else {
			$params = array_merge( $defaults, (array) $params );
		}

		return $this->api->export( $this, $params );
	}
38214
public function save($params = array()) {
        global $DB, $PAGE;

        // Figure out criteria description.
        // If it is coming from the form editor, it is an array(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->method = isset($params['agg']) ? $params['agg'] : BADGE_CRITERIA_AGGREGATION_ALL;
        $fordb->badgeid = $this->badgeid;
        $fordb->description = $description;
        $fordb->descriptionformat = $descriptionformat;
        $t = $DB->start_delegated_transaction();

        // Pick only params that are required by this criterion.
        // Filter out empty values first.
        $params = array_filter($params);
        // Find out which param matches optional and required ones.
        $match = array_merge($this->optional_params, array($this->required_param));
        $regex = implode('|', array_map(function($a) {
            return $a . "_";
        }, $match));
        $requiredkeys = preg_grep('/^(' . $regex . ').*$/', array_keys($params));

        if ($this->id !== 0) {
            $cid = $this->id;

            // Update criteria before doing anything with parameters.
            $fordb->id = $cid;
            $DB->update_record('badge_criteria', $fordb, true);

            // Trigger event: badge_criteria_updated.
            $eventparams = array('objectid' => $this->id,
                'context' => $PAGE->context,
                'other' => array('badgeid' => $this->badgeid));
            $event = \core\event\badge_criteria_updated::create($eventparams);
            $event->trigger();

            $existing = $DB->get_fieldset_select('badge_criteria_param', 'name', 'critid = ?', array($cid));
            $todelete = array_diff($existing, $requiredkeys);

            if (!empty($todelete)) {
                // A workaround to add some disabled elements that are still being submitted from the form.
                foreach ($todelete as $del) {
                    $name = explode('_', $del);
                    if ($name[0] == $this->required_param) {
                        foreach ($this->optional_params as $opt) {
                            $todelete[] = $opt . '_' . $name[1];
                        }
                    }
                }
                $todelete = array_unique($todelete);
                list($sql, $sqlparams) = $DB->get_in_or_equal($todelete, SQL_PARAMS_NAMED, 'd', true);
                $sqlparams = array_merge(array('critid' => $cid), $sqlparams);
                $DB->delete_records_select('badge_criteria_param', 'critid = :critid AND name ' . $sql, $sqlparams);
            }

            foreach ($requiredkeys as $key) {
                if (in_array($key, $existing)) {
                    $updp = $DB->get_record('badge_criteria_param', array('name' => $key, 'critid' => $cid));
                    $updp->value = $params[$key];
                    $DB->update_record('badge_criteria_param', $updp, true);
                } else {
                    $newp = new stdClass();
                    $newp->critid = $cid;
                    $newp->name = $key;
                    $newp->value = $params[$key];
                    $DB->insert_record('badge_criteria_param', $newp);
                }
            }
        } else {
            $cid = $DB->insert_record('badge_criteria', $fordb, true);
            if ($cid) {
                foreach ($requiredkeys as $key) {
                    $newp = new stdClass();
                    $newp->critid = $cid;
                    $newp->name = $key;
                    $newp->value = $params[$key];
                    $DB->insert_record('badge_criteria_param', $newp, false, true);
                }
            }
            // Trigger event: badge_criteria_created.
            $eventparams = array('objectid' => $this->id,
                'context' => $PAGE->context,
                'other' => array('badgeid' => $this->badgeid));
            $event = \core\event\badge_criteria_created::create($eventparams);
            $event->trigger();
        }
        $t->allow_commit();
    }
1077212
protected function addAdditionData(array $params, array $options)
    {
        if (isset($options['application']) && ctype_digit((string) $options['application'])) {
            $params['sponsor_id'] = (int) $options['application'];
        }

        if (isset($options['notify_url'])) {
            $params['notification_url'] = $options['notify_url'];
        }

        return $params;
    }
1238009
public function update($params, $optParams = [])
    {
        if (!$params instanceof AccessToken) {
            throw new InvalidParamException(AccessToken::class . ' is required!');
        }
        $class = get_class($params);

        return $this->sendRequest([], [
            'restAction' => 'update',
            'restId' => $params->id,
            'postParams' => $params->toArray(),
            'getParams' => $optParams,
        ], function ($response) use ($class) {
            return isset($response->data) ? new $class($response->data) : $response;
        });
    }
84431
public function main(array &$params)
    {
        $selectOptions = [];
        foreach (self::sortFields as $field) {
            $label = $this->languageService->sL($GLOBALS['TCA']['tt_address']['columns'][$field]['label']);
            $label = rtrim($label, ':');

            $selectOptions[] = [
                'field' => $field,
                'label' => $label
            ];
        }

        // add sorting by order of single selection
        $selectOptions[] = [
            'field' => 'singleSelection',
            'label' => $this->languageService->sL('LLL:EXT:tt_address/Resources/Private/Language/locallang_pi1.xlf:pi1_flexform.sortBy.singleSelection')
        ];

        // sort by labels
        $labels = [];
        foreach ($selectOptions as $key => $v) {
            $labels[$key] = $v['label'];
        }
        $labels = array_map('strtolower', $labels);
        array_multisort($labels, SORT_ASC, $selectOptions);

        // add fields to <select>
        foreach ($selectOptions as $option) {
            $params['items'][] = [
                $option['label'],
                $option['field']
            ];
        }
    }
691760
public function update($params = [])
    {
        $response = Guzzle::put("tournaments/{$this->id}", $params);
        return $this->updateModel($response->tournament);
    }
707582
public function assemble(array $params = [], array $options = [])
    {
        $elements              = [];
        $mergedParams          = array_replace($this->defaults, $params);
        $this->assembledParams = [];

        foreach ($this->exclude as $key) {
            unset($mergedParams[$key]);
        }

        if ($mergedParams) {
            foreach ($mergedParams as $key => $value) {
                if (is_array($value)) {
                    foreach ($value as $ivalue) {
                        $elements[] = rawurlencode($key) . $this->keyValueDelimiter . rawurlencode($ivalue);
                    }
                } else {
                    $elements[] = rawurlencode($key) . $this->keyValueDelimiter . rawurlencode($value);
                }
                $this->assembledParams[] = $key;
            }

            return $this->paramDelimiter . implode($this->paramDelimiter, $elements);
        }

        return '';
    }
284516
public function commit($method, $url, $params = [], $options = [])
    {
        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Content-Type'  => 'application/json',
                'User-Agent'    => 'MercadoPago PayMeBindings/'.$this->config['version'],
            ],
        ];

        if (!empty($params)) {
            $request[$method === 'get' ? 'query' : 'json'] = $params;
        }

        $authUrl = sprintf('%s?access_token=%s', $url, $this->config['private_key']);

        $rawResponse = $this->getHttpClient()->{$method}($authUrl, $request);

        $response = $this->parseResponse($rawResponse);

        return $this->respond($response, $rawResponse->getStatusCode());
    }