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


PHP RequestInterface::getPath方法代码示例

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


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

示例1: format

 /**
  * @inheritDoc
  */
 public function format(RequestInterface $request, ResponseInterface $response = null, \Exception $error = null, array $customData = [])
 {
     if (in_array($request->getPath(), $this->paths)) {
         $customData = array_merge(['url' => $this->mask((string) $request->getUrl()), 'resource' => $this->mask($request->getResource()), 'request' => $this->mask((string) $request), 'response' => $this->mask((string) $response), 'res_body' => $response ? $this->mask((string) $response) : 'NULL', 'req_body' => $this->mask((string) $request->getBody())], $customData);
     }
     return parent::format($request, $response, $error, $customData);
 }
开发者ID:onlinetravelgroup,项目名称:ean-client,代码行数:10,代码来源:Formatter.php

示例2: createRingRequest

 /**
  * Creates a Ring request from a request object.
  *
  * This function does not hook up the "then" and "progress" events that
  * would be required for actually sending a Guzzle request through a
  * RingPHP handler.
  *
  * @param RequestInterface $request Request to convert.
  *
  * @return array Converted Guzzle Ring request.
  */
 public static function createRingRequest(RequestInterface $request)
 {
     $options = $request->getConfig()->toArray();
     $url = $request->getUrl();
     // No need to calculate the query string twice (in URL and query).
     $qs = ($pos = strpos($url, '?')) ? substr($url, $pos + 1) : null;
     return ['scheme' => $request->getScheme(), 'http_method' => $request->getMethod(), 'url' => $url, 'uri' => $request->getPath(), 'headers' => $request->getHeaders(), 'body' => $request->getBody(), 'version' => $request->getProtocolVersion(), 'client' => $options, 'query_string' => $qs, 'future' => isset($options['future']) ? $options['future'] : false];
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:19,代码来源:RingBridge.php

示例3: checkRequest

 /**
  * @param RequestInterface $actual
  * @param RequestInterface $expected
  * @throws FailedRequestExpectationException
  */
 public static function checkRequest(RequestInterface $actual, RequestInterface $expected)
 {
     self::checkIsEqual($actual->getHost(), $expected->getHost(), 'host');
     self::checkIsEqual($actual->getPath(), $expected->getPath(), 'url path');
     self::checkIsEqual($actual->getMethod(), $expected->getMethod(), 'http method');
     self::checkRequestQuery($actual, $expected);
     self::checkContentType($actual, $expected);
     self::checkRequestBody($actual, $expected);
 }
开发者ID:lezhnev74,项目名称:GuzzleHttpMock,代码行数:14,代码来源:RequestChecker.php

示例4: getRequestAndQuery

 /**
  * @param RequestInterface $request
  * @return array ['query' => ..., 'request' => ...]
  */
 protected function getRequestAndQuery(RequestInterface $request)
 {
     $query = [];
     foreach ($request->getQuery() as $param => $val) {
         $query[$param] = $val;
     }
     $requestInfo = ['url' => $request->getUrl(), 'path' => $request->getPath(), 'queryString' => (string) $request->getQuery(), 'method' => $request->getMethod(), 'hostname' => $request->getHost(), 'port' => $request->getPort(), 'resource' => $request->getResource()];
     return ['query' => $query, 'request' => $requestInfo];
 }
开发者ID:keboola,项目名称:generic-extractor,代码行数:13,代码来源:AbstractSignature.php

示例5: __construct

 public function __construct(RequestInterface $pRequest)
 {
     /** url parsing "formula" for resource */
     list(, $subscription, $format, , $season, $week) = explode('/', $pRequest->getPath());
     $file_partial = __DIR__ . '/' . implode('.', [$subscription, $format, $season, $week]);
     $headers = (include $file_partial . '.header.php');
     $response_code = explode(' ', $headers[0])[1];
     $mocked_response = file_get_contents($file_partial . '.body.' . $format);
     $stream = Stream\Stream::factory($mocked_response);
     parent::__construct($response_code, $headers, $stream);
 }
开发者ID:JJVV27,项目名称:FantasyDataAPI,代码行数:11,代码来源:Mock.php

示例6: addCookieHeader

 public function addCookieHeader(RequestInterface $request)
 {
     $values = array();
     $scheme = $request->getScheme();
     $host = $request->getHost();
     $path = $request->getPath();
     foreach ($this->cookies as $cookie) {
         if ($cookie->matchesPath($path) && $cookie->matchesDomain($host) && !$cookie->isExpired() && (!$cookie->getSecure() || $scheme == 'https')) {
             $values[] = $cookie->getName() . '=' . self::getCookieValue($cookie->getValue());
         }
     }
     if ($values) {
         $request->setHeader('Cookie', implode('; ', $values));
     }
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:15,代码来源:CookieJar.php

示例7: extractCookiesArgument

 /**
  * @param RequestInterface $request
  */
 protected function extractCookiesArgument(RequestInterface $request)
 {
     $listeners = $request->getEmitter()->listeners('before');
     foreach ($listeners as $listener) {
         if ($listener[0] instanceof Cookie) {
             $values = [];
             $scheme = $request->getScheme();
             $host = $request->getHost();
             $path = $request->getPath();
             /** @var SetCookie $cookie */
             foreach ($listener[0]->getCookieJar() as $cookie) {
                 if ($cookie->matchesPath($path) && $cookie->matchesDomain($host) && !$cookie->isExpired() && (!$cookie->getSecure() || $scheme == 'https')) {
                     $values[] = $cookie->getName() . '=' . CookieJar::getCookieValue($cookie->getValue());
                 }
             }
             if ($values) {
                 $this->addOption('b', escapeshellarg(implode('; ', $values)));
             }
         }
     }
 }
开发者ID:mdrost,项目名称:cuzzle,代码行数:24,代码来源:CurlFormatter.php

示例8: getHash

 /**
  * Generate the hash based on the key, path and session
  *
  * @param  RequestInterface $request
  * @param  Collection $config
  * @return string
  */
 protected function getHash(RequestInterface $request, Collection $config)
 {
     // Remove the /api from the path to get the correct path
     $path = str_replace('/api', '', $request->getPath());
     return md5($config['key'] . '#' . $path . '#' . $config['session_id']);
 }
开发者ID:juukie,项目名称:php-knvb-dataservice-api,代码行数:13,代码来源:AuthenticationSubscriber.php

示例9: assertResponseAndRequestMatch

 /**
  * Asserts response match with the response schema.
  *
  * @param ResponseInterface $response
  * @param RequestInterface $request
  * @param SchemaManager $schemaManager
  * @param string $message
  */
 public function assertResponseAndRequestMatch(ResponseInterface $response, RequestInterface $request, SchemaManager $schemaManager, $message = '')
 {
     $this->assertResponseMatch($response, $schemaManager, $request->getPath(), $request->getMethod(), $message);
 }
开发者ID:Beanhunter,项目名称:SwaggerAssertions,代码行数:12,代码来源:GuzzleAssertsTrait.php

示例10: createContext

 /**
  * @internal Create the canonical representation of a request
  * @param RequestInterface $request Request to canonicalize
  * @param string           $payload Hash of the request payload
  * @return array Returns an array of context information
  */
 private function createContext(RequestInterface $request, $payload)
 {
     static $signable = ['host' => true, 'date' => true, 'content-md5' => true];
     // Normalize the path as required by SigV4 and ensure it's absolute
     $canon = $request->getMethod() . "\n" . '/' . ltrim($request->getPath(), '/') . "\n" . $this->getCanonicalizedQuery($request) . "\n";
     $canonHeaders = [];
     // Always include the "host", "date", and "x-amz-" headers.
     foreach ($request->getHeaders() as $key => $values) {
         $key = strtolower($key);
         if (isset($signable[$key]) || substr($key, 0, 6) === 'x-amz-') {
             if (count($values) == 1) {
                 $values = $values[0];
             } else {
                 sort($values);
                 $values = implode(',', $values);
             }
             $canonHeaders[$key] = $key . ':' . preg_replace('/\\s+/', ' ', $values);
         }
     }
     ksort($canonHeaders);
     $signedHeadersString = implode(';', array_keys($canonHeaders));
     $canon .= implode("\n", $canonHeaders) . "\n\n" . $signedHeadersString . "\n" . $payload;
     return ['creq' => $canon, 'headers' => $signedHeadersString];
 }
开发者ID:briareos,项目名称:aws-sdk-php,代码行数:30,代码来源:SignatureV4.php

示例11: collectRequest

 /**
  * Collect & sanitize data about a Guzzle request.
  *
  * @param RequestInterface $request Guzzle request.
  * @return array
  */
 private function collectRequest(RequestInterface $request)
 {
     $query = $request->getQuery();
     return ['headers' => $request->getHeaders(), 'method' => $request->getMethod(), 'scheme' => $request->getScheme(), 'host' => $request->getHost(), 'path' => $request->getPath(), 'query' => (string) $query, 'queryParams' => $query->toArray(), 'body' => (string) $request->getBody()];
 }
开发者ID:campru,项目名称:guzzle-bundle,代码行数:11,代码来源:GuzzleDataCollector.php

示例12: getName

 /**
  * @param RequestInterface $request
  *
  * @return string
  */
 private function getName(RequestInterface $request)
 {
     return $request->getMethod() . ' ' . $request->getPath();
 }
开发者ID:sroze,项目名称:tolerance,代码行数:9,代码来源:GuzzleMessageSpanFactory.php


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