2013-06-29 03:50:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PicoFeed;
|
|
|
|
|
|
|
|
abstract class Writer
|
|
|
|
{
|
|
|
|
public $items = array();
|
|
|
|
|
2013-06-29 19:41:36 +02:00
|
|
|
|
2013-06-29 03:50:15 +02:00
|
|
|
abstract public function execute($filename = '');
|
|
|
|
|
2013-06-29 19:41:36 +02:00
|
|
|
|
|
|
|
public function checkRequiredProperties($properties, $container)
|
2013-06-29 03:50:15 +02:00
|
|
|
{
|
2013-06-29 19:41:36 +02:00
|
|
|
foreach ($properties as $property) {
|
2013-06-29 03:50:15 +02:00
|
|
|
|
2013-06-29 19:41:36 +02:00
|
|
|
if ((is_object($container) && ! isset($container->$property)) || (is_array($container) && ! isset($container[$property]))) {
|
2013-06-29 03:50:15 +02:00
|
|
|
|
|
|
|
throw new \RuntimeException('Required property missing: '.$property);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|