pinterest-for-woocommerce
pinterest-for-woocommerce copied to clipboard
Make ProductsXMLFeed class more DRY
While reviewing #118, I noticed that the ProductsXmlFeed
class repeats this same portion of code multiple times:
return '<' . $property . '>' . $variable . '</' . $property . '>';
return '<' . $property . '><![CDATA[' . $variable . ']]></' . $property . '>';
I think there are two things could be improved here:
- There should be a dedicated method to create XML. Possibly also a dedicated method to output
CDATA
content specifically. - Instead of concatenation, I would recommend switching to interpolation or
sprintf()
instead.