Skip to content

Commit 110fc75

Browse files
committed
Merge branch 'release/2.0.2'
2 parents b982568 + d9e2320 commit 110fc75

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
## 2.0.2 - 2018-07-23
4+
- Issue #22 / Pull request #23 - Add support to invoke getLastRequest without throwing an InvalidArgumentException if the request is not executed
5+
36
## 2.0.1 - 2018-05-08
47
- Issue #19 - WSDL_CACHE_WSDL does not work!
58
- Code reviewed as it was not complete, default options were not taken into account properly too, it's working right from now on!

src/Utils.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ class Utils
99
* @throws \InvalidArgumentException
1010
* @param string $string
1111
* @param bool $asDomDocument
12-
* @return \DOMDocument|null
12+
* @return \DOMDocument|string|null
1313
*/
1414
public static function getFormatedXml($string, $asDomDocument = false)
1515
{
16-
$domDocument = self::getDOMDocument($string);
17-
return $asDomDocument ? $domDocument : $domDocument->saveXML();
16+
if (!is_null($string)) {
17+
$domDocument = self::getDOMDocument($string);
18+
return $asDomDocument ? $domDocument : $domDocument->saveXML();
19+
}
20+
return null;
1821
}
1922
/**
2023
* @param string $string

tests/UtilsTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ public function testGetFormatedXmlInvalidXmlAsDomDocument()
4141
{
4242
Utils::getFormatedXml('<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:img="http://ws.estesexpress.com/imageview" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.estesexpress.com/imageview" xml:lang="en"><root>', true);
4343
}
44+
/**
45+
*
46+
*/
47+
public function testGetFormatedXmlNullAsString()
48+
{
49+
$this->assertNull(Utils::getFormatedXml(null));
50+
}
51+
/**
52+
*
53+
*/
54+
public function testGetFormatedXmlNullAsDomDocument()
55+
{
56+
$this->assertNull(Utils::getFormatedXml(null, true));
57+
}
4458
/**
4559
*
4660
*/

0 commit comments

Comments
 (0)