summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php45
1 files changed, 42 insertions, 3 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
index 22d7c5951..34e557a11 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Item.php
@@ -103,6 +103,18 @@ class Item
public $namespaces = array();
/**
+ * Check if a XML namespace exists
+ *
+ * @access public
+ * @param string $namespace
+ * @return bool
+ */
+ public function hasNamespace($namespace)
+ {
+ return array_key_exists($namespace, $this->namespaces);
+ }
+
+ /**
* Get specific XML tag or attribute value.
*
* @param string $tag Tag name (examples: guid, media:content)
@@ -112,12 +124,10 @@ class Item
*/
public function getTag($tag, $attribute = '')
{
- // convert to xPath attribute query
if ($attribute !== '') {
$attribute = '/@'.$attribute;
}
- // construct query
$query = './/'.$tag.$attribute;
$elements = XmlParser::getXPathResult($this->xml, $query, $this->namespaces);
@@ -155,7 +165,10 @@ class Item
}
/**
- * Get url.
+ * Get URL
+ *
+ * @access public
+ * @return string
*/
public function getUrl()
{
@@ -163,6 +176,19 @@ class Item
}
/**
+ * Set URL
+ *
+ * @access public
+ * @param string $url
+ * @return Item
+ */
+ public function setUrl($url)
+ {
+ $this->url = $url;
+ return $this;
+ }
+
+ /**
* Get id.
*/
public function getId()
@@ -187,6 +213,19 @@ class Item
}
/**
+ * Set content
+ *
+ * @access public
+ * @param string $value
+ * @return Item
+ */
+ public function setContent($value)
+ {
+ $this->content = $value;
+ return $this;
+ }
+
+ /**
* Get enclosure url.
*/
public function getEnclosureUrl()