本文整理汇总了PHP中Google_Http_REST::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Google_Http_REST::execute方法的具体用法?PHP Google_Http_REST::execute怎么用?PHP Google_Http_REST::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Google_Http_REST
的用法示例。
在下文中一共展示了Google_Http_REST::execute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Helper method to execute deferred HTTP requests.
*
* @returns object of the type of the expected class or array.
*/
public function execute()
{
$this->maybeMoveParametersToBody();
return Google_Http_REST::execute($this->client, $this);
}
示例2: execute
/**
* Helper method to execute deferred HTTP requests.
*
* @param $request Google_Http_Request|Google_Http_Batch
* @throws Google_Exception
* @return object of the type of the expected class or array.
*/
public function execute($request)
{
if ($request instanceof Google_Http_Request) {
$request->setUserAgent($this->getApplicationName() . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion());
if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
$request->enableGzip();
}
$request->maybeMoveParametersToBody();
return Google_Http_REST::execute($this, $request);
} else {
if ($request instanceof Google_Http_Batch) {
return $request->execute();
} else {
throw new Google_Exception("Do not know how to execute this type of object.");
}
}
}
示例3: execute
/**
* Helper method to execute deferred HTTP requests.
*
* @param $request Psr\Http\Message\RequestInterface|Google_Http_Batch
* @throws Google_Exception
* @return object of the type of the expected class or Psr\Http\Message\ResponseInterface.
*/
public function execute(RequestInterface $request, $expectedClass = null)
{
$request = $request->withHeader('User-Agent', $this->config['application_name'] . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion());
// call the authorize method
// this is where most of the grunt work is done
$http = $this->authorize();
return Google_Http_REST::execute($http, $request, $expectedClass, $this->config['retry']);
}
示例4: makeRequest
/**
* Runs the defined request.
*
* @return array
*/
private function makeRequest()
{
$request = new Google_Http_Request('/test');
$io = $this->getMockBuilder('Google_IO_Abstract')->disableOriginalConstructor()->setMethods(array('makeRequest'))->getMockForAbstractClass();
$io->expects($this->exactly($this->mockedCallsCount))->method('makeRequest')->will($this->returnCallback(array($this, 'getNextMockedCall')));
$this->client->setIo($io);
return Google_Http_REST::execute($this->client, $request);
}
示例5: execute
/**
* Helper method to execute deferred HTTP requests.
*
* @param $request Google_Http_Request|Google_Http_Batch
* @throws Google_Exception
* @return object of the type of the expected class or array.
*/
public function execute($request)
{
if ($request instanceof Google_Http_Request) {
$request->setUserAgent($this->getApplicationName() . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion());
if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
$request->enableGzip();
}
$request->maybeMoveParametersToBody();
return Google_Http_REST::execute($this, $request);
} else {
if ($request instanceof Google_Http_Batch) {
return $request->execute();
} else {
//throw new Google_Exception("Do not know how to execute this type of object.");
echo json_encode(array('status' => FALSE, 'response-code' => 400, 'response' => "Do not know how to execute this type of object.", 'message' => ''));
die;
}
}
}
示例6: execute
/**
* Helper method to execute deferred HTTP requests.
*
* @param $request GuzzleHttp\Message\RequestInterface|Google_Http_Batch
* @throws Google_Exception
* @return object of the type of the expected class or array.
*/
public function execute($request, $expectedClass = null)
{
$request->setHeader('User-Agent', $this->config->get('application_name') . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion());
$http = $this->getHttpClient();
$result = Google_Http_REST::execute($http, $request, $this->config['retry']);
$expectedClass = $expectedClass ?: $request->getHeader('X-Php-Expected-Class');
if ($expectedClass) {
$result = new $expectedClass($result);
}
return $result;
}
示例7: makeRequest
/**
* Runs the defined request.
*
* @return array
*/
private function makeRequest()
{
$request = new Request('GET', '/test');
$http = $this->getMock('GuzzleHttp\\ClientInterface');
$http->expects($this->exactly($this->mockedCallsCount))->method('send')->will($this->returnCallback(array($this, 'getNextMockedCall')));
return Google_Http_REST::execute($http, $request, $this->retryConfig, $this->retryMap);
}