-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added function element_encode() #32
Conversation
Looks awesome, thanks! |
public function test_it_encodes_to_element(string $xml, array $data) | ||
{ | ||
$actual = element_encode($data); | ||
static::assertXmlStringEqualsXmlString($xml, $actual); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can make sure the XML header is not available in the result here?
docs/encoding.md
Outdated
@@ -32,6 +32,7 @@ The encoding components consist out of following functions | |||
|
|||
- [document_encode](#document_encode): Encodes an array into a DOM [Document](dom.md). | |||
- [element_decode](#element_decode): Decodes a DOMElement into an array. | |||
- [element_encode](#element_encode): Encodes an array into an XML string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the same comment as xml_encode, might be confusing for the developers
docs/encoding.md
Outdated
@@ -93,6 +94,30 @@ In the example above, we run an XSD validator before parsing the XML into an arr | |||
|
|||
More information about [the PHP format can be found here](#php-format). | |||
|
|||
#### element_encode | |||
|
|||
Encode transforms an array into an XML string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: looks like a better idea to differentiate and link between the two functions at the top.
Thank you for the feedback. I have made some changes accordingly. I hope the documentation is now a bit clearer as well. |
Yes it is. Thanks again for your PR! |
Summary