PayPal\Core\PPConnectionManager::getConnection PHP Method

getConnection() public method

This function returns a new PPHttpConnection object
public getConnection ( $httpConfig, $config )
    public function getConnection($httpConfig, $config)
    {
        if (isset($config["http.ConnectionTimeOut"])) {
            $httpConfig->setHttpTimeout($config["http.ConnectionTimeOut"]);
        }
        if (isset($config["http.Proxy"])) {
            $httpConfig->setHttpProxy($config["http.Proxy"]);
        }
        if (isset($config["http.Retry"])) {
            $retry = $config["http.Retry"];
            $httpConfig->setHttpRetryCount($retry);
        }
        return new PPHttpConnection($httpConfig, $config);
    }

Usage Example

 /**
  * @test
  */
 public function testGetConnection()
 {
     $conn = $this->object->getConnection(new PPHttpConfig("http://domain.com"), $this->config);
     $this->assertNotNull($conn);
     $this->assertTrue($conn instanceof PPHttpConnection);
     $this->assertEquals(get_class($conn), "PayPal\\Core\\PPHttpConnection");
 }