设置请求的方法，以及请求参数的设置

@throws \Exception
778996
private function _set_method()
    {
        switch (strtoupper($this->method)) {
        case 'HEAD':
            //CURLOPT_NOBODY TRUE 时将不输出 BODY 部分。同时 Mehtod 变成了 HEAD。修改为 FALSE 时不会变成 GET。
            if (!isset($this->config['CURLOPT_NOBODY'])) {
                $this->config['CURLOPT_NOBODY'] = true;
            }
            break;

        case 'GET':

            if (!empty($this->config['parameters'])) {

                $url = (stripos($this->config['CURLOPT_URL'], '?') !== false) ? '&' : '?';

                if (is_array($this->config['parameters'])) {  //参数是数组
                    $url .= http_build_query($this->_parameters, '', '&');
                } else { //参数是字符串
                    $url .= $this->config['parameters'];
                }

                $this->config['CURLOPT_URL'] = $url;
                unset($url);
            }

            $this->config['CURLOPT_HTTPGET'] = true;  //TRUE 时会设置 HTTP 的 method 为 GET

            break;

        case 'POST':

            if (!empty($this->parameters) && is_array($this->parameters)) { //参数是数组
                $data = http_build_query($this->parameters); //为了更好的兼容性
            } else {  //参数是字符串
                $data = $this->parameters;
            }

            $this->config['CURLOPT_POSTFIELDS'] = $data;  //post请求的数据
            $this->config['CURLOPT_POST'] = true;   //TRUE 时会发送 POST 请求，类型为：application/x-www-form-urlencoded，是 HTML 表单提交时最常见的一种。

            unset($data);

            break;

        default:
            throw new CurlException('该请求方式不支持！');
        }
    }
522504
public function flush()
    {
        if (!$this->getClient()->flush()) {
            throw new \Exception($this->getClient()->getResultMessage(), $this->getClient()->getResultCode());
        }
    }
838078
final public function execute()
	{
		if ($this->hadException()) {
			$this->setExceptionResponse($this->exception);
			return null;
		}

		$pageExtension = $this->container->getTemplating()->getExtension('supraPage');
		/* @var $pageExtension PageExtension */
		$pageExtension->setBlockExecutionContext(new BlockExecutionContext($this, $this->request));

		try {
			$this->doExecute();
		} catch (\Exception $e) {
			$this->exception = $e;
			$this->setExceptionResponse($e);
		}
	}
65872
public function init()
    {
        $this->conf = $this->getConfiguration();
        if (!isset($this->conf)) {
            throw new Exception("Adapter configuration not set, cannot initialize");
        }
        $this->adapters = array();
        foreach ($this->conf['adapters'] as $key => $adapter) {
            $adapterConf = ArrayHelper::merge($this->conf['common'], $adapter);

            $adapterConf['paymentHandler'] = $this;
            $adapterConf['adapterTag'] = $key;
            $this->adapters[$key] = \Yii::createObject($adapterConf);
        }
    }
297196
public function verifyConfig()
    {
        $keys = ['implementedFinders', 'implementedMethods'];
        foreach ($keys as $key) {
            if (!isset($this->_config[$key])) {
                continue;
            }

            foreach ($this->_config[$key] as $method) {
                if (!is_callable([$this, $method])) {
                    throw new Exception(sprintf('The method %s is not callable on class %s', $method, get_class($this)));
                }
            }
        }
    }
571934
public function handleException($exception)
    {
        if (!$this->ignorePrevHandler && $this->prevExceptionHandler) {
            call_user_func($this->prevExceptionHandler, $exception);
        }

        if (404 == $exception->getCode()) {
            if ($this->triggerHandler('notFound', $exception)) {
                return;
            }
        }

        if (!$this->triggerHandler('error', $exception)) {
            $this->internalHandleException($exception);
        }

        restore_exception_handler();
    }
223574
public function execAction()
    {
        //no action defined
        if(!$this->action) {
            throw new \Exception(sprintf('no action defined for subject %s', $this->name));
        }
        //exec method
        try {
            $this->checkTraitsInjections();
            $this->traitsInit();
            $this->{'exec'.$this->sanitizeAction($this->action)}();
        } catch(Exception $exception) {
        //no method defined
            throw new Exception(sprintf('no method for handling %s %s %s', AREA, $this->name, $this->action));
        }
    }
714997
public function delete()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new \Exception("wrong request mode");
        }

        $deleted = $this->getClassService()->deleteInstance($this->getCurrentInstance());

        $this->returnJson(array(
            'deleted' => $deleted
        ));
    }
1178062
public function execute()
	{
		$query  = $this->factory->builder($this->update)->process();
		$result = $this->pdo->query($query);
		if(!$result)
		{
			throw new \Exception('An error while updating is occurred');
		}
	}
1175100
public function add($key, $value)
    {
        if ($this->getReadOnly()) {
            throw new Exception('只读map，不允许执行添加操作', 100100603);
        }
        if (null === $key) {
            $this->_data[] = $value;
        } else {
            $this->_data[$key] = $value;
        }
    }
691554
public function execute()
    {
        if (!defined('ENABLE_SHELL_PLUGIN') || !ENABLE_SHELL_PLUGIN) {
            throw new \Exception(Lang::get('shell_not_enabled'));
        }

        $success = true;

        foreach ($this->commands as $command) {
            $command = $this->phpci->interpolate($command);

            if (!$this->phpci->executeCommand($command)) {
                $success = false;
            }
        }

        return $success;
    }
250413
public function run()
    {
        try {

            // ~ Hook for console help
            if (! $this->argument->has('name')) {

                // ~ Display Help
                $this->help();

                // ~ If no help asked, throw exception !
                if (! $this->argument->has('help')) {
                    throw new \Exception(__METHOD__ . '|Script name must be defined !');
                }

                return;
            }

            // ~ Create new object '*'
            $className = $this->argument->get('name');
            $script = new $className();

            if (!($script instanceof ConsoleInterface)) {
                throw new \Exception('Current script must be implement ConsoleInterface interface !');
            }

            if (! $script->executable()) {
                throw new \Exception(__METHOD__ . '|Script is not executable !');
            }

            $style = new Style(' >>> RUN - ' . $className . ' - ' . date('Y-m-d H:i:s') . ' <<<');
            $style->color('fg', Style::COLOR_GREEN);

            if ($this->argument->has('help')) {

                Out::std($style->get());

                $script->help();
            } else {

                // ~ Execute this method before starting main script method
                $script->before();

                // ~ Display header script only after execution of before method (prevent error with start_session() for example).
                Out::std($style->get());

                // ~ Execute main script method.
                $script->run();

                // ~ Execute this method after execution of main script method.
                $script->after();
            }
        } catch (\Exception $exception) {

            if (! $this->isVerbose) {
                throw $exception;
            }

            $style = new Style(' ~~ EXCEPTION[' . $exception->getCode() . ']: ' . $exception->getMessage());
            $style->color('bg', Style::COLOR_RED);
            Out::std(PHP_EOL . $style->get());

            if ($this->argument->has('debug')) {
                echo $exception->getTraceAsString(), PHP_EOL;
            }
        }
    }
871656
public function process($value)
        {

            if ($this->isMandatory() && !$value)
            {
                throw new Exception($this->getMessage(self::IS_MISSING, ['param', $this->reference]));
            }

            $dataProcessor = $this->getDataProcessor();

            if ($dataProcessor instanceof ApplicationAwareInterface)
            {
                $dataProcessor->setApplication($this->getApplication());
            }

            $processedValue = $dataProcessor->process($value);

            if($this->isMandatory() && is_null($processedValue))
            {
                throw new Exception($this->getMessage(self::IS_MISSING, ['param', $this->reference]));
            }

            return $processedValue;
        }
1266924
public function rollback()
    {
        if ($this->_active && $this->_db->getActive()) {
            $this->_db->getPdoInstance()->rollBack();
            $this->_active = false;
        } else {
            throw new Exception('"Transaction"尚属未激活状态，不能执行"commit"和"rollback"操作', 101300602);
        }
    }
1311668
public function execute()
    {
        $this->_setOptions();

        $sResponse = $this->_execute();
        $this->_saveStatusCode();

        $iCurlErrorNumber = $this->_getErrorNumber();

        $this->_close();

        if ($iCurlErrorNumber) {
            $host = $this->getUrl();
            $parameters = http_build_query($this->getParameters(), "", "&");
            $message = $this->_getErrorMessage($iCurlErrorNumber);
            throw new Exception("cURL failed with message '$message' when calling '$host?$parameters'");
        }

        return $sResponse;
    }
432009
public function execute()
    {
        $db = $this->dbHandle;
        $db->/** @scrutinizer ignore-call */
        sqliteCreateFunction('log', 'log', 1);
        $sql = '
		INSERT INTO inverse_document_frequency (term, inverseDocumentFrequency)
		SELECT DISTINCT term, (1+(log(:documentCount / COUNT(documentPath) + 1))) AS inverseDocumentFrequency
					  FROM term_count
				  GROUP BY term
		';

        if (!$stmt = $db->prepare($sql)) {
            $errorInfo = $db->errorInfo();
            $errorMsg = $errorInfo[2];
            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
        }
        $stmt->bindValue(':documentCount', $this->documentCount);
        $result = $stmt->execute();
        if ($result === false) {
            $errorInfo = $db->errorInfo();
            $errorMsg = $errorInfo[2];
            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
        }
    }
1297242
public function get_instance() {
        if ( empty( $this->options->instance ) ) {
            return $this;
        }

        if ( ! is_callable( $this->options->instance ) ) {
            throw new Exception( sprintf( '`%s` is not callable', $this->options->instance ) );
        }

        return call_user_func( $this->options->instance );
    }