getByAccountName() public static method

Static method to create a Feed Reader object from an account name
public static getByAccountName ( string $service, string $name, integer $limit, string $prefix = 'Pop\Feed\Format\' ) : Reader
$service string
$name string
$limit integer
$prefix string
return Reader
Exemplo n.º 1
0
 public function testGetByAccountNameException()
 {
     $this->setExpectedException('Pop\\Feed\\Exception');
     $feed = Feed\Reader::getByAccountName('badservice', '1234567890', 4);
 }
Exemplo n.º 2
0
<?php

require_once '../../bootstrap.php';
use Pop\Feed;
try {
    $tmpl = <<<POSTS
    <div class="post-div">
        <a href="[{link}]">[{title}]</a><br />
        <strong>[{published}]</strong> ([{time}])<br />
    </div>

POSTS;
    $facebook = Feed\Reader::getByAccountName('facebook', 'highvoltagenola', 3);
    $facebook->setTemplate($tmpl);
    echo '<h1>' . $facebook->title . '</h1>' . PHP_EOL;
    echo '<h4>' . $facebook->likes . ' Likes</h4>' . PHP_EOL;
    $facebook->render();
} catch (\Exception $e) {
    echo $e->getMessage();
}
Exemplo n.º 3
0
<?php

require_once '../../bootstrap.php';
use Pop\Feed;
try {
    $tmpl = <<<POSTS
    <div class="post-div">
        <a href="[{link}]">[{title}]</a><br />
        <strong>[{published}]</strong> ([{time}])<br />
    </div>

POSTS;
    $twitter = Feed\Reader::getByAccountName('twitter', 'highvoltagenola', 3);
    //$twitter = new Feed\Reader(new Feed\Format\Rss\Twitter(array('name' => 'highvoltagenola'), 3));
    $twitter->setTemplate($tmpl);
    echo '<h1>' . $twitter->title . '</h1>' . PHP_EOL;
    echo '<h4>' . $twitter->tweets . ' Tweets : ' . $twitter->following . ' Following : ' . $twitter->followers . ' Followers</h4>' . PHP_EOL;
    $twitter->render();
} catch (\Exception $e) {
    echo $e->getMessage();
}