summaryrefslogtreecommitdiff
path: root/vendor/miniflux/picofeed/lib/PicoFeed/Syndication/ItemBuilder.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/miniflux/picofeed/lib/PicoFeed/Syndication/ItemBuilder.php')
-rw-r--r--vendor/miniflux/picofeed/lib/PicoFeed/Syndication/ItemBuilder.php209
1 files changed, 209 insertions, 0 deletions
diff --git a/vendor/miniflux/picofeed/lib/PicoFeed/Syndication/ItemBuilder.php b/vendor/miniflux/picofeed/lib/PicoFeed/Syndication/ItemBuilder.php
new file mode 100644
index 00000000..86985bc7
--- /dev/null
+++ b/vendor/miniflux/picofeed/lib/PicoFeed/Syndication/ItemBuilder.php
@@ -0,0 +1,209 @@
+<?php
+
+namespace PicoFeed\Syndication;
+
+use DateTime;
+use DOMElement;
+
+/**
+ * Class ItemBuilder
+ *
+ * @package PicoFeed\Syndication
+ * @author Frederic Guillot
+ */
+abstract class ItemBuilder
+{
+ /**
+ * @var string
+ */
+ protected $itemTitle;
+
+ /**
+ * @var string
+ */
+ protected $itemId;
+
+ /**
+ * @var string
+ */
+ protected $itemSummary;
+
+ /**
+ * @var string
+ */
+ protected $authorName;
+
+ /**
+ * @var string
+ */
+ protected $authorEmail;
+
+ /**
+ * @var string
+ */
+ protected $authorUrl;
+
+ /**
+ * @var DateTime
+ */
+ protected $itemPublishedDate;
+
+ /**
+ * @var DateTime
+ */
+ protected $itemUpdatedDate;
+
+ /**
+ * @var string
+ */
+ protected $itemContent;
+
+ /**
+ * @var string
+ */
+ protected $itemUrl;
+
+ /**
+ * @var FeedBuilder
+ */
+ protected $feedBuilder;
+
+ /**
+ * Constructor
+ *
+ * @param FeedBuilder $feedBuilder
+ */
+ public function __construct(FeedBuilder $feedBuilder)
+ {
+ $this->feedBuilder = $feedBuilder;
+ }
+
+ /**
+ * Get new object instance
+ *
+ * @access public
+ * @param FeedBuilder $feedBuilder
+ * @return static
+ */
+ public static function create(FeedBuilder $feedBuilder)
+ {
+ return new static($feedBuilder);
+ }
+
+ /**
+ * Add item title
+ *
+ * @access public
+ * @param string $title
+ * @return $this
+ */
+ public function withTitle($title)
+ {
+ $this->itemTitle = $title;
+ return $this;
+ }
+
+ /**
+ * Add item id
+ *
+ * @access public
+ * @param string $id
+ * @return $this
+ */
+ public function withId($id)
+ {
+ $this->itemId = $id;
+ return $this;
+ }
+
+ /**
+ * Add item url
+ *
+ * @access public
+ * @param string $url
+ * @return $this
+ */
+ public function withUrl($url)
+ {
+ $this->itemUrl = $url;
+ return $this;
+ }
+
+ /**
+ * Add item summary
+ *
+ * @access public
+ * @param string $summary
+ * @return $this
+ */
+ public function withSummary($summary)
+ {
+ $this->itemSummary = $summary;
+ return $this;
+ }
+
+ /**
+ * Add item content
+ *
+ * @access public
+ * @param string $content
+ * @return $this
+ */
+ public function withContent($content)
+ {
+ $this->itemContent = $content;
+ return $this;
+ }
+
+ /**
+ * Add item updated date
+ *
+ * @access public
+ * @param DateTime $date
+ * @return $this
+ */
+ public function withUpdatedDate(DateTime $date)
+ {
+ $this->itemUpdatedDate = $date;
+ return $this;
+ }
+
+ /**
+ * Add item published date
+ *
+ * @access public
+ * @param DateTime $date
+ * @return $this
+ */
+ public function withPublishedDate(DateTime $date)
+ {
+ $this->itemPublishedDate = $date;
+ return $this;
+ }
+
+ /**
+ * Add item author
+ *
+ * @access public
+ * @param string $name
+ * @param string $email
+ * @param string $url
+ * @return $this
+ */
+ public function withAuthor($name, $email = '', $url ='')
+ {
+ $this->authorName = $name;
+ $this->authorEmail = $email;
+ $this->authorUrl = $url;
+ return $this;
+ }
+
+ /**
+ * Build item
+ *
+ * @abstract
+ * @access public
+ * @return DOMElement
+ */
+ abstract public function build();
+}