-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ololower/rss-version
Version attribute for RSS element added
- Loading branch information
Showing
3 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Vitalybaev\GoogleMerchant; | ||
|
||
class RssElement implements \Sabre\Xml\XmlSerializable | ||
{ | ||
|
||
private $value; | ||
|
||
/** | ||
* Rss version attribute | ||
* @var string | ||
*/ | ||
private $rssVersion; | ||
|
||
/** | ||
* RssElement constructor. | ||
* | ||
* @param $value | ||
* @param string $rssVersion | ||
*/ | ||
public function __construct($value, $rssVersion = '') | ||
{ | ||
$this->value = $value; | ||
$this->rssVersion = (string)$rssVersion; | ||
} | ||
|
||
public function xmlSerialize(\Sabre\Xml\Writer $writer) | ||
{ | ||
if ($this->rssVersion) { | ||
$writer->writeAttribute('version', $this->rssVersion); | ||
} | ||
|
||
$writer->write($this->value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters