static function instance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; }
<?php include 'header.php'; $feed = FeedMapper::instance()->find($_GET['id']); $item_helper = new ItemHelper(); ?> <table> <th>id</th><th>title</th> <?php foreach ($feed->items() as $item) { ?> <tr> <td><?php echo $item->id(); ?> </td> <td><?php echo $item_helper->link($item); ?> </td> </tr> <?php } ?>
function feed() { return FeedMapper::instance()->find($this->feed_id()); }
function mapper() { return FeedMapper::instance(); }
<?php include 'header.php'; $feeds = FeedMapper::instance()->find_all(); $feed_helper = new FeedHelper(); ?> <table> <tr><th>id</th><th>title</th><th>feed url</th><th>time to live</th> <tr> <?php foreach ($feeds as $feed) { ?> <tr> <td><?php echo $feed->id(); ?> </td> <td><?php echo $feed_helper->link($feed); ?> </td> <td><?php echo $feed->feed_url(); ?> </td> <td><?php echo $feed->time_to_live();