Initalises the cURL handle and sets some defaults

@param array $initVars
string $initVars['url'],
string $initVars['method'],
array $initVars['headers'],
mixed $initVars['data'];

@return boolean
557349
public function init(array $initVars) {
        if (filter_var($initVars['url'], FILTER_VALIDATE_URL)) {
            $this->handle = curl_init($initVars['url']);

            // If headers are set
            if (isset($initVars['headers'])) {
                $this->setOpt(CURLOPT_HTTPHEADER, $initVars['headers']);
            }

            // Set method of request
            switch ($initVars['method']) {
                case 'GET':
                    break;
                case 'PUT':
                    $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
                    $this->setOpt(CURLOPT_POSTFIELDS, $initVars['data']);
                    break;
                case 'POST':
                    $this->setOpt(CURLOPT_CUSTOMREQUEST, 'POST');
                    $this->setOpt(CURLOPT_POSTFIELDS, $initVars['data']);
                    break;
                default:
                    break;
            }

            return true;
        } else {
            return false;
        }
    }
276025
protected function setJSONPayload($vars) {
    $this->headers['Content-Type'] = 'application/json';
    $this->headers['Content-Length'] = 0;
    $this->headers['Expect'] = '';

    if (!empty($vars)) {
      $data = json_encode($vars);
      $this->headers['Content-Length'] = strlen($data);
      curl_setopt($this->request, CURLOPT_POSTFIELDS, $data);
    }
  }
396412
public function _setInit($key = null, $val = null)
    {
        if (is_null($key)) {
            $this->_init = array();
        } elseif (is_null($val)) {
            unset($this->_init[$key]);
        } else {
            switch ($key) {
            case 'capability':
                if ($ci = $this->getParam('capability_ignore')) {
                    $ignored = array();

                    foreach ($ci as $val2) {
                        $c = explode('=', $val2);

                        if ($val->query($c[0], isset($c[1]) ? $c[1] : null)) {
                            $ignored[] = $val2;
                            $val->remove($c[0], isset($c[1]) ? $c[1] : null);
                        }
                    }

                    if ($this->_debug->debug && !empty($ignored)) {
                        $this->_debug->info(sprintf(
                            'CONFIG: IGNORING these IMAP capabilities: %s',
                            implode(', ', $ignored)
                        ));
                    }
                }

                $val->attach($this);
                break;
            }

            /* Nothing has changed. */
            if (isset($this->_init[$key]) && ($this->_init[$key] === $val)) {
                return;
            }

            $this->_init[$key] = $val;
        }

        $this->changed = true;
    }
743483
public function setInitValues(array $values)
    {
        if (isset($this->data['isSend']) == false || $this->data['isSend'] != true) {
            foreach ($this->elements as $name => $element) {
                if ($element instanceof ElementInterface) {
                    if (array_key_exists($name, $values)) {
                        $element->setValue($values[$name]);
                    }
                }
            }
        }
    }
929216
public function input($inputVars)
    {
        foreach ($inputVars as $key => $val) {
            if (empty($this->allowed_fields[$key])) {
                echo "Invalid input $key - perhaps misspelled field?\n";
                return false;
            }
            $this->queries[$key] = urlencode($this->filter_field($key, $val));
        }
        $this->queries['clientAPI'] = self::API_VERSION;
    }
314393
protected function set_variables() {
		if ( ! is_array( $this->variables ) ) {
			$variable        = ( is_string( $this->variables ) && ! empty( $this->variables ) ) ? $this->variables : false;
			$this->variables = [];
			if ( $variable && empty( $this->variables ) ) {
				$this->variables[0]['name'] = $variable;
			}
		}
	}
904374
public function initialize(array $parameters = array())
        {
            // set default parameters
            foreach ($this->getDefaultParameters() as $key => $value) {
                if (is_array($value)) {
                    $this->parameters->set($key, reset($value));
                } else {
                    $this->parameters->set($key, $value);
                }
            }
            $this->helper->initialize($this, $parameters);
            return $this;
        }
1059147
public function reset()
    {
        if (is_resource($this->handle)) {
            curl_reset($this->handle);
            $this->setDefaults();
            return true;
        }

        return false;
    }
35961
private static function createNewURLSearchParamsObject($query, $init)
    {
        if (!$query) {
            $query = new static();
        }
        if ($init instanceof URLSearchParams) {
            $query->list = $init->list;
        } elseif (is_array($init)) {
            foreach ($init as $pair) {
                if (count($pair) !== 2) {
                    throw new TypeError(
                        'URLSearchParams require name/value tuples when being initialized by a sequence.'
                    );
                }
            }
            $query->list = $init;
        } elseif ($init instanceof \esperecyan\webidl\Record) {
            foreach ($init as $name => $value) {
                $query->list[] = [$name, $value];
            }
        } else {
            $query->list = lib\URLencoding::parseURLencodedString($init);
        }
        return $query;
    }
749
protected function init($url, $postString, $headers)
    {
        $this->headers = $headers;

        $this->curl = curl_init($url);

        if (empty($this->cookieJar)) {
            $this->loadCookies();
        }

        curl_setopt_array($this->curl, $this->makeHttpOptions($postString));

        return $this;
    }
1270239
private static function init(RequestOptions $options)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $options->Url);
        curl_setopt_array($ch, self::$defaultOptions);  //default options
        //include headers in response
        curl_setopt($ch, CURLOPT_HEADER, $options->IncludeHeaders);
        //include body in response
        curl_setopt($ch, CURLOPT_NOBODY, !$options->IncludeBody);
        //Set method
        if($options->Method == HttpMethod::Post)
            curl_setopt($ch, CURLOPT_POST, 1);
        else if($options->Method == HttpMethod::Patch)
           curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method);
        else if($options->Method == HttpMethod::Delete)
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $options->Method);
        //set Post Body
        if(isset($options->Data))
            curl_setopt($ch, CURLOPT_POSTFIELDS, $options->Data);
        if(is_resource($options->StreamHandle)) {
            $opt = $options->Method === HttpMethod::Get ? CURLOPT_FILE : CURLOPT_INFILE;
            curl_setopt($ch, $opt, $options->StreamHandle);
        }
        $options->addCustomHeader("content-length",strlen($options->Data));
        //custom HTTP headers
        if($options->Headers)
            curl_setopt($ch, CURLOPT_HTTPHEADER, $options->getRawHeaders());
        //debugging mode
        curl_setopt($ch,CURLOPT_VERBOSE, $options->Verbose);
        //SSL Version
        if(!is_null($options->SSLVersion)) {
            curl_setopt($ch,CURLOPT_SSLVERSION, $options->SSLVersion);
        }
        //authentication
        if(!is_null($options->AuthType))
            curl_setopt($ch,CURLOPT_HTTPAUTH, $options->AuthType);
        if(!is_null($options->UserCredentials))
            curl_setopt($ch,CURLOPT_USERPWD, $options->UserCredentials->toString());

        return $ch;
    }
1255311
private function init()
    {
        $this->curl = curl_init();
        $this->setUserAgent(self::USER_AGENT);
        $this->setOpt(CURLINFO_HEADER_OUT, true);
        $this->setOpt(CURLOPT_HEADER, false);
        $this->setOpt(CURLOPT_RETURNTRANSFER, true);
        $this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'addResponseHeaderLine'));
        return $this;
    }
299054
protected function onInit()
    {
        $params = array();
        foreach ($this->params as $cKey=>$cValue) {
            switch(gettype($cValue))
            {
            case "string":
            case "number":
            case "object":
                $params[$cKey] = array(
                    "exp"=>$cValue,
                    "type"=>"number",
                );
                break;
            case "array":
                if (!isset($cValue['exp'])) {
                    $cValue['exp']="'no expression'";
                }
                if (!isset($cValue['type'])) {
                    $cValue['type']="unknown";
                }
                $params[$cKey] = $cValue;
                break;
            }
        }
        $this->params = $params;
    }
961417
protected function initAttrs()
    {
        $attrs = self::getAttrs();
        foreach ($attrs as $key => $attr) {
            if (! isset($attr['default'])) continue;
            if (! isset($this->cleanData[$key])) {
                $this->$key = $attr['default'];
            }
        }
    }
1296028
public static function init(){
		if(self::$initialized){
			return true;
			}
		$surl=$_SERVER["REQUEST_URI"];
		if(empty($surl)){
			return false;
			}
		$squery=parse_url($surl,PHP_URL_QUERY);
			if(empty($squery)){
			return false;
			}
		//Parsing string "a=1&b=3&c=abc" into array
		$query=array();
		parse_str($squery,$query);
		self::$variables=$query;
		self::$initialized=true;
		return true;
		}
636035
public function initialize() {
        $this->handler = curl_init();

        $this->setOption(CURLOPT_URL, $this->requestUrl)
             ->setOption(CURLOPT_VERBOSE, 0)
             ->setOption(CURLOPT_HEADER, 0);
    }
985003
protected function initOptions()
    {
        if (!empty($this->requestParams)) {
            if (isset($this->options[CURLOPT_HTTPGET])) {
                $this->prepareGetParams();
            } else {
                $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->requestParams));
            }
        }

        if (!empty($this->headers)) {
            $this->addOption(CURLOPT_HTTPHEADER, $this->prepareHeaders());
        }

        if (!empty($this->cookieFile)) {
            $this->addOption(CURLOPT_COOKIEFILE, $this->cookieFile);
            $this->addOption(CURLOPT_COOKIEJAR, $this->cookieFile);
        }

        if (!empty($this->cookies)) {
            $this->addOption(CURLOPT_COOKIE, $this->prepareCookies());
        }

        if (!curl_setopt_array($this->ch, $this->options)) {
            throw new CurlWrapperCurlException($this->ch);
        }
    }