API/Client.php
private function setup(array $config) {
		$r = new C(null, $config + [
			'timeout' => 120
			/**
			 * 2017-07-16
			 * By default it is «Zend_Http_Client»: @see C::$config
			 * https://github.com/magento/zf1/blob/1.13.1/library/Zend/Http/Client.php#L126
			 */
			,'useragent' => 'Mage2.PRO'
		]); /** @var C $r */
		/** @var aProxy|aSocket $a */
		if (!($p = $this->proxy())) {  /** @var IProxy $p */
			$a = new aSocket;
		}
		else {
			// 2019-01-14
			// https://framework.zend.com/manual/1.12/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy
			$a = new aProxy;
			$r->setConfig([
				'proxy_host' => $p->host()
				,'proxy_pass' => $p->password()
				,'proxy_port' => $p->port()
				,'proxy_user' => $p->username()
			]);
		}
		if ($p || !$this->verifyCertificate()) {
			$ssl = ['allow_self_signed' => true, 'verify_peer' => false]; /** @var array(string => bool) $ssl */
			if ($p) {
				// 2019-01-14 It is needed for my proxy: https://stackoverflow.com/a/32047219
				$ssl['verify_peer_name'] = false;
			}
			$a->setStreamContext(['ssl' => $ssl]);
		}
		$r->setAdapter($a);
		return $r;
	}
private function setup(array $config) {
		$r = new C(null, $config + [
			'timeout' => 120
			/**
			 * 2017-07-16
			 * By default it is «Zend_Http_Client»: @see C::$config
			 * https://github.com/magento/zf1/blob/1.13.1/library/Zend/Http/Client.php#L126
			 */
			,'useragent' => 'Mage2.PRO'
		]); /** @var C $r */
		/** @var aProxy|aSocket $a */
		if (!($p = $this->proxy())) {  /** @var IProxy $p */
			$a = new aSocket;
		}
		else {
			// 2019-01-14
			// https://framework.zend.com/manual/1.12/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy
			$a = new aProxy;
			$r->setConfig([
				'proxy_host' => $p->host()
				,'proxy_pass' => $p->password()
				,'proxy_port' => $p->port()
				,'proxy_user' => $p->username()
			]);
		}
		if ($p || !$this->verifyCertificate()) {
			$ssl = ['allow_self_signed' => true, 'verify_peer' => false]; /** @var array(string => bool) $ssl */
			if ($p) {
				// 2019-01-14 It is needed for my proxy: https://stackoverflow.com/a/32047219
				$ssl['verify_peer_name'] = false;
			}
			$a->setStreamContext(['ssl' => $ssl]);
		}
		$r->setAdapter($a);
		return $r;
	}
private function setup ( array $ config ) { $ r = new C ( null , $ config + [ 'timeout' => 120 /**
			 * 2017-07-16
			 * By default it is «Zend_Http_Client»: @see C::$config
			 * https://github.com/magento/zf1/blob/1.13.1/library/Zend/Http/Client.php#L126
			 */ , 'useragent' => 'Mage2.PRO' ] ) ; /** @var C $r */ /** @var aProxy|aSocket $a */ if ( ! ( $ p = $ this -> proxy ( ) ) ) { /** @var IProxy $p */ $ a = new aSocket ; } else { // 2019-01-14 // https://framework.zend.com/manual/1.12/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy $ a = new aProxy ; $ r -> setConfig ( [ 'proxy_host' => $ p -> host ( ) , 'proxy_pass' => $ p -> password ( ) , 'proxy_port' => $ p -> port ( ) , 'proxy_user' => $ p -> username ( ) ] ) ; } if ( $ p || ! $ this -> verifyCertificate ( ) ) { $ ssl = [ 'allow_self_signed' => true , 'verify_peer' => false ] ; /** @var array(string => bool) $ssl */ if ( $ p ) { // 2019-01-14 It is needed for my proxy: https://stackoverflow.com/a/32047219 $ ssl [ 'verify_peer_name' ] = false ; } $ a -> setStreamContext ( [ 'ssl' => $ ssl ] ) ; } $ r -> setAdapter ( $ a ) ; return $ r ; }
2019-01-14
@used-by __construct()
@param array(string => mixed) $config
@return C
2019 - 01 - 14