Example #1
0
 /**
  * Returns HTTP Client
  * @return \Magento\Framework\HTTP\IClient|null
  */
 public function getDownloader()
 {
     if (is_null($this->_http)) {
         $this->_http = \Magento\Framework\HTTP\Client::getInstance();
     }
     return $this->_http;
 }
Example #2
0
 /**
  * Factory for HTTP client
  * @param string/false $protocol  'curl'/'socket' or false for auto-detect
  * @return \Magento\Framework\HTTP\Client|\Magento\Framework\Connect\Loader\Ftp
  */
 public static function getInstance($protocol = '')
 {
     if ($protocol == 'ftp') {
         return new \Magento\Framework\Connect\Loader\Ftp();
     } else {
         return \Magento\Framework\HTTP\Client::getInstance();
     }
 }