0b4a93c8b94e3d4cc873d3a7b5eff73679e4f48e
[WP-Plugins/glm-member-db.git] /
1 <?php
2 namespace PayPal\Core;
3 use PayPal\Core\PPConnectionManager;
4 use PayPal\Core\PPHttpConnection;
5 class PPConnectionManager
6 {
7         /**
8          * reference to singleton instance
9          * @var PPConnectionManager
10          */
11         private static $instance;
12
13         private function __construct()
14         {
15         }
16
17         public static function getInstance() {
18                 if( self::$instance == null ) {
19                         self::$instance = new PPConnectionManager();
20                 }
21                 return self::$instance;
22         }
23
24         /**
25          * This function returns a new PPHttpConnection object
26          */
27         public function getConnection($httpConfig, $config) {
28                 if(isset( $config["http.ConnectionTimeOut"] )) {
29                         $httpConfig->setHttpTimeout( $config["http.ConnectionTimeOut"] );
30                 }
31                 if(isset( $config["http.Proxy"] )) {
32                         $httpConfig->setHttpProxy($config["http.Proxy"] );
33                 }
34                 if(isset( $config["http.Retry"] )) {
35                         $retry =  $config["http.Retry"];
36                         $httpConfig->setHttpRetryCount($retry ) ;
37                 }
38                 
39                 return new PPHttpConnection($httpConfig, $config);
40         }
41
42 }