2014-05-20 20:20:27 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PicoFeed;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Feed
|
|
|
|
*
|
|
|
|
* @author Frederic Guillot
|
|
|
|
* @package picofeed
|
|
|
|
*/
|
|
|
|
class Feed
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Feed items
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $items = array();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Feed id
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $id = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Feed title
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $title = '';
|
|
|
|
|
|
|
|
/**
|
2014-10-19 20:42:31 +02:00
|
|
|
* Feed description
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $description = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Feed url
|
2014-05-20 20:20:27 +02:00
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $url = '';
|
|
|
|
|
|
|
|
/**
|
2014-10-19 20:42:31 +02:00
|
|
|
* Feed date
|
2014-05-20 20:20:27 +02:00
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var integer
|
|
|
|
*/
|
|
|
|
public $date = 0;
|
|
|
|
|
|
|
|
/**
|
2014-10-19 20:42:31 +02:00
|
|
|
* Feed language
|
2014-05-20 20:20:27 +02:00
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $language = '';
|
|
|
|
|
2014-10-19 20:42:31 +02:00
|
|
|
/**
|
|
|
|
* Feed logo URL (not the same as icon)
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $logo = '';
|
|
|
|
|
2014-05-20 20:20:27 +02:00
|
|
|
/**
|
|
|
|
* Return feed information
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
$output = '';
|
|
|
|
|
2014-10-19 20:42:31 +02:00
|
|
|
foreach (array('id', 'title', 'url', 'date', 'language', 'description', 'logo') as $property) {
|
2014-05-20 20:20:27 +02:00
|
|
|
$output .= 'Feed::'.$property.' = '.$this->$property.PHP_EOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
$output .= 'Feed::items = '.count($this->items).' items'.PHP_EOL;
|
|
|
|
|
|
|
|
foreach ($this->items as $item) {
|
|
|
|
$output .= '----'.PHP_EOL;
|
|
|
|
$output .= $item;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get title
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function getTitle()
|
|
|
|
{
|
|
|
|
return $this->title;
|
|
|
|
}
|
|
|
|
|
2014-10-19 20:42:31 +02:00
|
|
|
/**
|
|
|
|
* Get description
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function getDescription()
|
|
|
|
{
|
|
|
|
return $this->description;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the logo url
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function getLogo()
|
|
|
|
{
|
|
|
|
return $this->logo;
|
|
|
|
}
|
|
|
|
|
2014-05-20 20:20:27 +02:00
|
|
|
/**
|
|
|
|
* Get url
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function getUrl()
|
|
|
|
{
|
|
|
|
return $this->url;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get date
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return integer
|
|
|
|
*/
|
|
|
|
public function getDate()
|
|
|
|
{
|
|
|
|
return $this->date;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get language
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function getLanguage()
|
|
|
|
{
|
|
|
|
return $this->language;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get id
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return string
|
|
|
|
*/
|
|
|
|
public function getId()
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get feed items
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* $return array
|
|
|
|
*/
|
|
|
|
public function getItems()
|
|
|
|
{
|
|
|
|
return $this->items;
|
|
|
|
}
|
|
|
|
}
|