pinterest-for-woocommerce icon indicating copy to clipboard operation
pinterest-for-woocommerce copied to clipboard

Make ProductsXMLFeed class more DRY

Open JPry opened this issue 3 years ago • 0 comments

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:

  1. There should be a dedicated method to create XML. Possibly also a dedicated method to output CDATA content specifically.
  2. Instead of concatenation, I would recommend switching to interpolation or sprintf() instead.

JPry avatar Aug 02 '21 20:08 JPry