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


PHP ResponseInterface::xml方法代码示例

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


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

示例1: __invoke

 public function __invoke(ResponseInterface $response)
 {
     \SellerCenter\SDK\Common\AnnotationRegistry::registerAutoloadNamespace();
     if (count($response->xml()->xpath('/ErrorResponse'))) {
         $serializer = SerializerBuilder::create()->build();
         return $serializer->deserialize($response->xml()->asXML(), 'SellerCenter\\SDK\\Common\\Api\\Response\\Error\\ErrorResponse', 'xml');
     }
     return;
 }
开发者ID:danielcosta,项目名称:sellercenter-sdk,代码行数:9,代码来源:XmlErrorParser.php

示例2: parse

 public function parse(Session $rets, ResponseInterface $response, $parameters)
 {
     $xml = $response->xml();
     $rs = new Results();
     $rs->setSession($rets)->setResource($parameters['SearchType'])->setClass($parameters['Class']);
     if ($this->getRestrictedIndicator($rets, $xml, $parameters)) {
         $rs->setRestrictedIndicator($this->getRestrictedIndicator($rets, $xml, $parameters));
     }
     $rs->setHeaders($this->getColumnNames($rets, $xml, $parameters));
     $rets->debug(count($rs->getHeaders()) . ' column headers/fields given');
     $this->parseRecords($rets, $xml, $parameters, $rs);
     if ($this->getTotalCount($rets, $xml, $parameters) !== null) {
         $rs->setTotalResultsCount($this->getTotalCount($rets, $xml, $parameters));
         $rets->debug($rs->getTotalResultsCount() . ' total results found');
     }
     $rets->debug($rs->getReturnedResultsCount() . ' results given');
     if ($this->foundMaxRows($rets, $xml, $parameters)) {
         // MAXROWS tag found.  the RETS server withheld records.
         // if the server supports Offset, more requests can be sent to page through results
         // until this tag isn't found anymore.
         $rs->setMaxRowsReached();
         $rets->debug('Maximum rows returned in response');
     }
     unset($xml);
     return $rs;
 }
开发者ID:mitchlayzell,项目名称:PHRETS,代码行数:26,代码来源:OneX.php

示例3: parse

 public function parse(Session $rets, ResponseInterface $response)
 {
     $xml = $response->xml();
     $base = $xml->METADATA->{'METADATA-SYSTEM'};
     $metadata = new \PHRETS\Models\Metadata\System();
     $metadata->setSession($rets);
     $configuration = $rets->getConfiguration();
     if ($configuration->getRetsVersion()->is1_5()) {
         if (isset($base->System->SystemID)) {
             $metadata->setSystemId((string) $base->System->SystemID);
         }
         if (isset($base->System->SystemDescription)) {
             $metadata->setSystemDescription((string) $base->System->SystemDescription);
         }
     } else {
         if (isset($base->SYSTEM->attributes()->SystemID)) {
             $metadata->setSystemId((string) $base->SYSTEM->attributes()->SystemID);
         }
         if (isset($base->SYSTEM->attributes()->SystemDescription)) {
             $metadata->setSystemDescription((string) $base->SYSTEM->attributes()->SystemDescription);
         }
         if (isset($base->SYSTEM->attributes()->TimeZoneOffset)) {
             $metadata->setTimezoneOffset((string) $base->SYSTEM->attributes()->TimeZoneOffset);
         }
     }
     if (isset($base->SYSTEM->Comments)) {
         $metadata->setComments((string) $base->SYSTEM->Comments);
     }
     if (isset($base->attributes()->Version)) {
         $metadata->setVersion((string) $xml->METADATA->{'METADATA-SYSTEM'}->attributes()->Version);
     }
     return $metadata;
 }
开发者ID:mitchlayzell,项目名称:PHRETS,代码行数:33,代码来源:System.php

示例4: __construct

 /**
  * Sets attributes from response xml.
  *
  * @param ResponseInterface $response
  * @param array $attributes
  */
 public function __construct(ResponseInterface $response, array $attributes = null)
 {
     $this->response = $response;
     if (is_null($attributes)) {
         $attributes = Xml::elementsToArray($response->xml()->xpath('/RESPONSE/FIELDS/*'));
     }
     parent::__construct($attributes);
 }
开发者ID:RDelorier,项目名称:first-americam-xml,代码行数:14,代码来源:Response.php

示例5: __invoke

 public function __invoke(CommandInterface $command, ResponseInterface $response)
 {
     $output = $this->api->getOperation($command->getName())->getOutput();
     $xml = $response->xml();
     if ($this->honorResultWrapper && $output['resultWrapper']) {
         $xml = $xml->{$output['resultWrapper']};
     }
     return new Result($this->xmlParser->parse($output, $xml));
 }
开发者ID:briareos,项目名称:aws-sdk-php,代码行数:9,代码来源:QueryParser.php

示例6: isUserInSharedData

 public function isUserInSharedData($user)
 {
     $data = $this->response->xml()->data[0];
     foreach ($data as $element) {
         if ($element->share_with == $user) {
             return True;
         }
     }
     return False;
 }
开发者ID:uppers12,项目名称:core,代码行数:10,代码来源:FeatureContext.php

示例7: send

 /**
  * Run request to Restoration Media
  */
 public function send()
 {
     $request = $this->client->createRequest('GET', $this->getBuiltUrl());
     $request->setHeader('User-Agent', 'github.com/caseyw/restorationmedia_php');
     $this->response = $this->client->send($request);
     /*
      * Restoration Media doesn't actually use HTTP Status Codes. I don't know why.
      */
     return 'success.' == $this->response->xml() ? true : false;
 }
开发者ID:caseyw,项目名称:restorationmedia-php,代码行数:13,代码来源:RestorationMediaApi.php

示例8: getResponse

 protected function getResponse(GuzzleResponse $response)
 {
     if (strpos($response->getHeader('Content-Type'), 'json')) {
         $returnResponse = new JsonResponse($response->getBody());
     } elseif (strpos($response->getHeader('Content-Type'), 'xml')) {
         $returnResponse = new XmlResponse($response->xml());
     } else {
         throw new \Exception('Unknow return type');
     }
     return $returnResponse;
 }
开发者ID:bxav,项目名称:service_handler,代码行数:11,代码来源:ResellerClubClient.php

示例9: execute

 /**
  * Execute the command
  *
  * @param Command $command
  * @return bool
  */
 public function execute(Command $command)
 {
     $cookies = CookieJar::fromArray(['TokenKey' => $this->getToken()], $this->hostname);
     $client = $this->getClient();
     // Get the request method
     $method = $command->getMethod();
     // get the url
     $url = $command->getUrl($this->endpoint);
     // create the request object with the cookie
     $this->lastRequest = $client->createRequest($method, $url, $command->getPayload(['cookies' => $cookies]));
     $this->lastResponse = $client->send($this->lastRequest);
     $xml = $this->lastResponse->xml();
     return isset($xml->Success) && $xml->Success;
 }
开发者ID:ianchadwick,项目名称:maxcontact,代码行数:20,代码来源:Client.php

示例10: getArrayOfShareesResponded

 public function getArrayOfShareesResponded(ResponseInterface $response, $shareeType)
 {
     $elements = $response->xml()->data;
     $elements = json_decode(json_encode($elements), 1);
     if (strpos($shareeType, 'exact ') === 0) {
         $elements = $elements['exact'];
         $shareeType = substr($shareeType, 6);
     }
     $sharees = [];
     foreach ($elements[$shareeType] as $element) {
         $sharees[] = [$element['label'], $element['value']['shareType'], $element['value']['shareWith']];
     }
     return $sharees;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:14,代码来源:ShareesContext.php

示例11: parse

 public function parse(Session $rets, ResponseInterface $response)
 {
     $xml = $response->xml();
     $collection = new Collection();
     if ($xml->METADATA) {
         foreach ($xml->METADATA->{'METADATA-OBJECT'}->Object as $key => $value) {
             $metadata = new \PHRETS\Models\Metadata\Object();
             $metadata->setSession($rets);
             $obj = $this->loadFromXml($metadata, $value, $xml->METADATA->{'METADATA-OBJECT'});
             $collection->put($obj->getObjectType(), $obj);
         }
     }
     return $collection;
 }
开发者ID:mitchlayzell,项目名称:PHRETS,代码行数:14,代码来源:Object.php

示例12: parse

 public function parse(Session $rets, ResponseInterface $response, $keyed_by)
 {
     $xml = $response->xml();
     $collection = new Collection();
     if ($xml->METADATA) {
         foreach ($xml->METADATA->{'METADATA-TABLE'}->Field as $key => $value) {
             $metadata = new \PHRETS\Models\Metadata\Table();
             $metadata->setSession($rets);
             $this->loadFromXml($metadata, $value, $xml->METADATA->{'METADATA-TABLE'});
             $method = 'get' . $keyed_by;
             $collection->put((string) $metadata->{$method}(), $metadata);
         }
     }
     return $collection;
 }
开发者ID:mitchlayzell,项目名称:PHRETS,代码行数:15,代码来源:Table.php

示例13: parse

 public function parse(Session $rets, ResponseInterface $response)
 {
     $xml = $response->xml();
     $collection = new Collection();
     if ($xml->METADATA) {
         // some servers don't name this correctly for the version of RETS used, so play nice with either way
         if (!empty($xml->METADATA->{'METADATA-LOOKUP_TYPE'}->LookupType)) {
             $base = $xml->METADATA->{'METADATA-LOOKUP_TYPE'}->LookupType;
         } else {
             $base = $xml->METADATA->{'METADATA-LOOKUP_TYPE'}->Lookup;
         }
         foreach ($base as $key => $value) {
             $metadata = new \PHRETS\Models\Metadata\LookupType();
             $metadata->setSession($rets);
             $collection->push($this->loadFromXml($metadata, $value, $xml->METADATA->{'METADATA-LOOKUP_TYPE'}));
         }
     }
     return $collection;
 }
开发者ID:mitchlayzell,项目名称:PHRETS,代码行数:19,代码来源:LookupType.php

示例14: parse

 /**
  * @param ResponseInterface $response
  * @param string            $deserialize
  *
  * @return mixed
  */
 protected function parse(ResponseInterface $response, $deserialize)
 {
     return $this->parser->parse($response->xml(), $deserialize);
 }
开发者ID:danielcosta,项目名称:sellercenter-sdk,代码行数:10,代码来源:RestXmlParser.php

示例15: parseResponse

 /**
  * @param string $call
  * @param ResponseInterface $rawResponse
  *
  * @return Response
  */
 protected function parseResponse($call, ResponseInterface $rawResponse)
 {
     $response = new Response();
     $responseArray = json_decode(json_encode($rawResponse->xml()), true);
     $response->setMethod($call);
     if (!array_key_exists('message', $responseArray)) {
         $response->setCode(999);
         $response->setMessage('Invalid response received.');
     } else {
         $response->setCode(intval($responseArray['message']['code']));
         $response->setMessage($responseArray['message']['text']);
     }
     if ($response->isSuccessful() && array_key_exists('response', $responseArray)) {
         $response->setData($responseArray['response']);
     }
     return $response;
 }
开发者ID:brentmullen,项目名称:zillow-api,代码行数:23,代码来源:ZillowApiClient.php


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