Skip to content

Commit 1d8f9a4

Browse files
committed
refactor code, update annotation
1 parent bf2124f commit 1d8f9a4

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

AbstractSoapClientBase.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,7 @@ public function setLocation($location)
318318
*/
319319
public function getLastRequest($asDomDocument = false)
320320
{
321-
$request = null;
322-
if (self::getSoapClient() instanceof \SoapClient) {
323-
$request = self::getFormatedXml(self::getSoapClient()->__getLastRequest(), $asDomDocument);
324-
}
325-
return $request;
321+
return $this->getLastXml('__getLastRequest', $asDomDocument);
326322
}
327323
/**
328324
* Returns the last response content as a DOMDocument or as a formated XML String
@@ -335,11 +331,20 @@ public function getLastRequest($asDomDocument = false)
335331
*/
336332
public function getLastResponse($asDomDocument = false)
337333
{
338-
$response = null;
334+
return $this->getLastXml('__getLastResponse', $asDomDocument);
335+
}
336+
/**
337+
* @param string $method
338+
* @param bool $asDomDocument
339+
* @return \DOMDocument|string|null
340+
*/
341+
protected function getLastXml($method, $asDomDocument = false)
342+
{
343+
$xml = null;
339344
if (self::getSoapClient() instanceof \SoapClient) {
340-
$response = self::getFormatedXml(self::getSoapClient()->__getLastResponse(), $asDomDocument);
345+
$xml = self::getFormatedXml(self::getSoapClient()->$method(), $asDomDocument);
341346
}
342-
return $response;
347+
return $xml;
343348
}
344349
/**
345350
* Returns the last request headers used by the SoapClient object as the original value or an array

Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Utils
88
* Returns a XML string content as a DOMDocument or as a formated XML string
99
* @throws \InvalidArgumentException
1010
* @param string $string
11-
* @param string $asDomDocument
11+
* @param bool $asDomDocument
1212
* @return \DOMDocument|null
1313
*/
1414
public static function getFormatedXml($string, $asDomDocument = false)

0 commit comments

Comments
 (0)