当前位置: 首页>>代码示例>>PHP>>正文


PHP ClientInterface::delete方法代码示例

本文整理汇总了PHP中GuzzleHttp\ClientInterface::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::delete方法的具体用法?PHP ClientInterface::delete怎么用?PHP ClientInterface::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GuzzleHttp\ClientInterface的用法示例。


在下文中一共展示了ClientInterface::delete方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Execute an operaction
  *
  * A successful operation will return result as an array.
  * An unsuccessful operation will return null.
  *
  * @param  OperationInterface $op
  * @return array|null
  */
 public function execute(OperationInterface $op)
 {
     try {
         if ($op instanceof DeleteOperationInterface) {
             $response = $this->httpClient->delete($op->getEndpoint(), ['headers' => $op->getHeaders()]);
         } elseif ($op instanceof PostOperationInterface) {
             $response = $this->httpClient->post($op->getEndpoint(), ['headers' => $op->getHeaders(), 'body' => $op->getData()]);
         } elseif ($op instanceof PatchOperationInterface) {
             $response = $this->httpClient->patch($op->getEndpoint(), ['headers' => $op->getHeaders(), 'body' => $op->getData()]);
         } elseif ($op instanceof PutOperationInterface) {
             $response = $this->httpClient->put($op->getEndpoint(), ['headers' => $op->getHeaders(), 'body' => $op->getData()]);
         } else {
             $response = $this->httpClient->get($op->getEndpoint());
         }
     } catch (GuzzleHttp\Exception\ClientException $e) {
         throw new Exception\ClientException('ClientException occurred in request to Orchestrate: ' . $e->getMessage(), $e->getCode(), $e);
     } catch (GuzzleHttp\Exception\ServerException $e) {
         throw new Exception\ServerException('ServerException occurred in request to Orchestrate: ' . $e->getMessage(), $e->getCode(), $e);
     }
     $refLink = null;
     $location = null;
     if ($response->hasHeader('ETag')) {
         $refLink = str_replace('"', '', $response->getHeaderLine('ETag'));
     } elseif ($response->hasHeader('Link')) {
         $refLink = str_replace(['<', '>; rel="next"'], ['', ''], $response->getHeaderLine('Link'));
     }
     if ($response->hasHeader('Location')) {
         $location = $response->getHeaderLine('Location');
     }
     $rawValue = $response->getBody(true);
     $value = json_decode($rawValue, true);
     return $op->getObjectFromResponse($refLink, $location, $value, $rawValue);
 }
开发者ID:absynthe,项目名称:orchestrate-php-client,代码行数:42,代码来源:Client.php

示例2: delete

 /**
  * {@inheritdoc}
  */
 public function delete($url = null, array $headers = [])
 {
     try {
         $response = $this->guzzleClient->delete($url, ['headers' => $headers]);
     } catch (\Exception $e) {
         throw new RequestException($e->getMessage(), $e->getCode(), $e);
     }
     return new Response($response->getStatusCode(), $response->getHeaders(), (string) $response->getBody());
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:12,代码来源:GuzzleHttpClient.php

示例3: delete

 /**
  * {@inheritdoc}
  */
 public function delete($url)
 {
     try {
         $this->response = $this->client->delete($url);
     } catch (RequestException $e) {
         $this->response = $e->getResponse();
         $this->handleError();
     }
     return $this->response->getBody();
 }
开发者ID:softr,项目名称:asaas-php-sdk,代码行数:13,代码来源:GuzzleHttpAdapter.php

示例4: delete

 /**
  * Executa uma requisição DELETE.
  *
  * @param $part
  * @param array $data
  * @param array $headers
  * @return mixed
  */
 public function delete($part, $data = [], array $headers = [])
 {
     $opts = ['headers' => array_merge([], $this->headers, $headers)];
     $part = uri_params($part, $data);
     $response = new Response($this->client->delete($part, $opts));
     return $response->make();
 }
开发者ID:bugotech,项目名称:rfm,代码行数:15,代码来源:GenericConnection.php

示例5: delete

 /**
  * {@inheritDoc}
  */
 public function delete(Request $request)
 {
     $response = null;
     try {
         $response = $this->client->delete($request->getPath(), array_merge(['body' => $request->getBody()], $this->getConfiguration($request)));
     } catch (RequestException $e) {
         $this->handleRequestException($request, $e);
     }
     return $this->createResponse($response);
 }
开发者ID:gunnartorfis,项目名称:plex_requests,代码行数:13,代码来源:GuzzleAdapter.php

示例6: deactivate

 /**
  * Deactivate Subscription for ID
  *
  * @param string $id
  *
  * @return string|false
  */
 public function deactivate($id)
 {
     $url = 'subscribe/' . $id;
     if ($this->isExpandedResults()) {
         $url .= '?expand_results=1';
     }
     $this->response = $this->client->delete($url);
     if (200 == $this->response->getStatusCode()) {
         return $this->response->json();
     }
     return false;
 }
开发者ID:caseyw,项目名称:ziprecruiter-php,代码行数:19,代码来源:ZipRecruiterApi.php

示例7: delete

 /**
  * Make a DELETE request.
  *
  * @param  string $endpoint
  * @param  array  $options
  * @return object
  */
 public function delete($url, array $options = [])
 {
     $response = $this->client->delete($url, $options);
     return $this->getBody($response);
 }
开发者ID:sebdesign,项目名称:laravel-viva-payments,代码行数:12,代码来源:Client.php

示例8: delete

 /**
  * Delete the resource.
  *
  * @return array
  */
 public function delete()
 {
     return $this->client->delete($this->getUri())->json();
 }
开发者ID:CompanyOnTheWorld,项目名称:platformsh-client-php,代码行数:9,代码来源:Resource.php

示例9: delete

 /**
  * {@inheritdoc}
  */
 public function delete($url, array $headers = array())
 {
     $options = array('headers' => $headers);
     $this->response = $this->client->delete($url, $options);
     return $this->response->getBody();
 }
开发者ID:fideloper,项目名称:DigitalOceanV2,代码行数:9,代码来源:Guzzle5Adapter.php

示例10: delete

 /**
  * {@inheritdoc}
  */
 public function delete($url)
 {
     $response = $this->client->delete($this->urlMutator($url));
     return $this->_decodeStream($response->getBody());
 }
开发者ID:rockoo,项目名称:InstagramAPI,代码行数:8,代码来源:GuzzleAdapter.php

示例11: delete

 /**
  * {@inheritdoc }
  */
 public function delete($url)
 {
     return $this->httpClient->delete($url);
 }
开发者ID:Owsy,项目名称:sylius-api-php,代码行数:7,代码来源:Client.php


注:本文中的GuzzleHttp\ClientInterface::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。