Switch to Composer
This commit is contained in:
parent
ce709fec80
commit
fda6e3d811
393 changed files with 14048 additions and 17 deletions
95
vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php
vendored
Normal file
95
vendor/fguillot/picofeed/lib/PicoFeed/Syndication/Writer.php
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
namespace PicoFeed\Syndication;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Base writer class.
|
||||
*
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
abstract class Writer
|
||||
{
|
||||
/**
|
||||
* Dom object.
|
||||
*
|
||||
* @var \DomDocument
|
||||
*/
|
||||
protected $dom;
|
||||
|
||||
/**
|
||||
* Items.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $items = array();
|
||||
|
||||
/**
|
||||
* Author.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $author = array();
|
||||
|
||||
/**
|
||||
* Feed URL.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $feed_url = '';
|
||||
|
||||
/**
|
||||
* Website URL.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $site_url = '';
|
||||
|
||||
/**
|
||||
* Feed title.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title = '';
|
||||
|
||||
/**
|
||||
* Feed description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $description = '';
|
||||
|
||||
/**
|
||||
* Feed modification date (timestamp).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $updated = 0;
|
||||
|
||||
/**
|
||||
* Generate the XML document.
|
||||
*
|
||||
* @abstract
|
||||
*
|
||||
* @param string $filename Optional filename
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function execute($filename = '');
|
||||
|
||||
/**
|
||||
* Check required properties to generate the output.
|
||||
*
|
||||
* @param array $properties List of properties
|
||||
* @param mixed $container Object or array container
|
||||
*/
|
||||
public function checkRequiredProperties(array $properties, $container)
|
||||
{
|
||||
foreach ($properties as $property) {
|
||||
if ((is_object($container) && !isset($container->$property)) || (is_array($container) && !isset($container[$property]))) {
|
||||
throw new RuntimeException('Required property missing: '.$property);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue