Provide a singleton instance to simplify integration. If you prefer
to manage the lifecycle of the config object, then consider using
"probe()" or "new" instead.

@return CA_Config_Curl
515967
static public function singleton()
    {
        if (! self::$_singleton) {
            global $CA_CONFIG;
            self::$_singleton = self::probe($CA_CONFIG ? $CA_CONFIG : array());
        }
        return self::$_singleton;
    }
1091078
public function getElasticSearchClient()
    {
        $config = $this->getElasticConfig();

        // elasticsearch v2.0 using builder
        if (class_exists('\Elasticsearch\ClientBuilder')) {
            return \Elasticsearch\ClientBuilder::fromConfig($config);
        }

        // elasticsearch v1
        return new \Elasticsearch\Client($config);
    }
180653
public static function newInstance($config = null)
	{

		if (!function_exists('curl_init')) {
			throw new Exception('Curl required');
		}

		$gateway = new self();

		if (null !== $config) {
			Config::setAll($config);
		}

		return $gateway;

	}
1297326
public static function getInstance()
    {
        if ( self::$instance === null ) {
            self::$instance = new Config( self::$file );
        }
        
        return self::$instance;
    }
640454
protected static function getInstance()
    {
        $type = self::getType();
        $appID = App::getCurrentID();
        $complementID = self::getCurrentID();
        $complement = get_called_class();
        if (! isset(self::$instances[$appID][$type][$complementID])) {
            self::$instances[$appID][$type][$complementID] = new $complement();
        }

        return self::$instances[$appID][$type][$complementID];
    }
398293
protected function _initialize() {
        $this->_ch = curl_init();
        $this->_last_info = FALSE;
        curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->_ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($this->_ch, CURLOPT_TIMEOUT, 60);
        curl_setopt($this->_ch, CURLOPT_CONNECTTIMEOUT, 60);
        curl_setopt($this->_ch, CURLOPT_USERPWD, "{$this->_username}:{$this->_password}");

        return;
    }
746709
public function curlInit()
    {
        if ($this->offline === false) {
            $this->curl = \curl_init(); // create curl resource
            curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); // return content as a string from curl_exec
            curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true); // follow redirects (compatibility for future changes in FlexiBee)
            curl_setopt($this->curl, CURLOPT_HTTPAUTH, true);       // HTTP authentication
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false); // FlexiBee by default uses Self-Signed certificates
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($this->curl, CURLOPT_VERBOSE, ($this->debug === true)); // For debugging
            if (empty($this->authSessionId)) {
                curl_setopt($this->curl, CURLOPT_USERPWD,
                    $this->user.':'.$this->password); // set username and password
            }
            if (!is_null($this->timeout)) {
                curl_setopt($this->curl, CURLOPT_TIMEOUT, $this->timeout);
            }
        }
        return !$this->offline;
    }
1301391
private function httpClient()
    {
        if (!self::$httpClient) {
            self::$httpClient = HttpClient\CurlClient::instance();
        }
        return self::$httpClient;
    }
1240630
final public static function instance() {
        $c = get_called_class();
       
        if( ! isset( self::$instances[$c] ) )
        {
            self::$instances[$c] = new $c;
        }
       
        return self::$instances[$c];
    }
1304688
public function createProbe(ProfileConfiguration $config = null, $enable = true)
    {
        if (null === $config) {
            $config = new ProfileConfiguration();
        }

        $probe = new Probe($this->doCreateRequest($config));

        if ($enable) {
            $probe->enable();
        }

        return $probe;
    }
821093
public static function instance()
    {
        if (null === self::$_instance) {
            $capsule = new Capsule;
            $capsule->addConnection(self::getConfig());
            $capsule->setEventDispatcher(new Dispatcher(new Container));
            $capsule->setAsGlobal();

            self::$_instance = $capsule;
        }
        return self::$_instance;
    }
138249
public static function getInstance()
    {
        if (self::$instance == null)
        {
            $c = __CLASS__;
            self::$instance = new $c;
        }

        return self::$instance;
    }
580933
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new CacheProperties();

			self::$instance->init( CoreGlobal::CONFIG_CACHE );
		}

		return self::$instance;
	}
311226
public function instance()
    {
        if ($this->crudApi->instance === null) {
            $fq = $this->getModel();
            $instance = new $fq();
            $this->crudApi->setInstance($instance);
        }

        return $this->crudApi->instance;
    }
656333
public function getProbes()
	{
		$client = new \Guzzle\Service\Client('https://api.pingdom.com/api/2.0');

		/** @var $request \Guzzle\Http\Message\Request */
		$request = $client->get('probes', array('App-Key' => $this->token));
		$request->setAuth($this->username, $this->password);
		$response = $request->send();
		$response = json_decode($response->getBody(), true);
		$probes   = array();

		foreach ($response['probes'] as $attributes) {
			$probes[] = new Probe\Server($attributes);
		}

		return $probes;
	}
319903
protected function curlInit()
    {
        $curlHandle = curl_init();
        curl_setopt($curlHandle, CURLOPT_URL, $this->requestUrl);
        $this->requestUrl = $this->url;  // Reset request URL
        // Set Curl Options
        foreach ($this->curlOptions as $key => $value) {
            curl_setopt($curlHandle, $key, $value);
        }

        // Check if have header
        if (count($this->requestHeader) > 0) {
            curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $this->requestHeader);
            $this->requestHeader = []; // Reset request Header
        }

        // Add Cookies
        if (count($this->cookies) > 0) {
            curl_setopt($curlHandle, CURLOPT_COOKIE, implode(";", $this->cookies));
            $this->cookies = []; // Reset request Header
        }

        // Set last fetched URL
        $this->lastFetchedUrl = null;

        return $curlHandle;
    }
670843
private function createCurl()
    {
        $parameters = $this->getParameters();
        $timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0) * 1000;

        if (filter_var($host = $parameters->host, FILTER_VALIDATE_IP)) {
            $host = "[$host]";
        }

        $options = array(
            CURLOPT_FAILONERROR => true,
            CURLOPT_CONNECTTIMEOUT_MS => $timeout,
            CURLOPT_URL => "$parameters->scheme://$host:$parameters->port",
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_POST => true,
            CURLOPT_WRITEFUNCTION => array($this, 'feedReader'),
        );

        if (isset($parameters->user, $parameters->pass)) {
            $options[CURLOPT_USERPWD] = "{$parameters->user}:{$parameters->pass}";
        }

        curl_setopt_array($resource = curl_init(), $options);

        return $resource;
    }