/** * @param \SimpleXMLElement $xml * @return GetTranslationsResponse */ public static function fromXml(\SimpleXMLElement $xml) { $instance = new GetTranslationsResponse($xml->From, $xml->State); foreach ($xml->Translations->TranslationMatch as $match) { $instance->addTranslation(TranslationMatch::fromXmlElement($match)); } return $instance; }
/** * @param \GuzzleHttp\Message\ResponseInterface $response * @return GetTranslationsResponse[] */ public function processResponse(\GuzzleHttp\Message\ResponseInterface $response) { $xml = simplexml_load_string($response->getBody()->getContents()); $responses = []; foreach ($xml->GetTranslationsResponse as $node) { $responses[] = GetTranslationsResponse::fromXml($node); } return $responses; }
/** * @param \GuzzleHttp\Message\ResponseInterface $response * @return GetTranslationsResponse */ public function processResponse(\GuzzleHttp\Message\ResponseInterface $response) { $xml = simplexml_load_string($response->getBody()->getContents()); return GetTranslationsResponse::fromXml($xml); }