Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Access.php
Go to the documentation of this file.
1 <?php
23 #require_once 'Zend/Oauth/Token.php';
24 
26 #require_once 'Zend/Oauth/Http.php';
27 
29 #require_once 'Zend/Uri/Http.php';
30 
32 #require_once 'Zend/Oauth/Client.php';
33 
41 {
51  public function toHeader(
52  $url, Zend_Oauth_Config_ConfigInterface $config, array $customParams = null, $realm = null
53  ) {
54  if (!Zend_Uri::check($url)) {
55  #require_once 'Zend/Oauth/Exception.php';
56  throw new Zend_Oauth_Exception(
57  '\'' . $url . '\' is not a valid URI'
58  );
59  }
60  $params = $this->_httpUtility->assembleParams($url, $config, $customParams);
61  return $this->_httpUtility->toAuthorizationHeader($params, $realm);
62  }
63 
72  public function toQueryString($url, Zend_Oauth_Config_ConfigInterface $config, array $params = null)
73  {
74  if (!Zend_Uri::check($url)) {
75  #require_once 'Zend/Oauth/Exception.php';
76  throw new Zend_Oauth_Exception(
77  '\'' . $url . '\' is not a valid URI'
78  );
79  }
80  $params = $this->_httpUtility->assembleParams($url, $config, $params);
81  return $this->_httpUtility->toEncodedQueryString($params);
82  }
83 
93  public function getHttpClient(array $oauthOptions, $uri = null, $config = null, $excludeCustomParamsFromHeader = true)
94  {
95  $client = new Zend_Oauth_Client($oauthOptions, $uri, $config, $excludeCustomParamsFromHeader);
96  $client->setToken($this);
97  return $client;
98  }
99 }
$config
Definition: fraud_order.php:17
static check($uri)
Definition: Uri.php:72
toHeader( $url, Zend_Oauth_Config_ConfigInterface $config, array $customParams=null, $realm=null)
Definition: Access.php:51