當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。