示例#1
0
 public function onRun()
 {
     try {
         $latestTweet = TwitterClient::instance()->getLatestTweet(["tweet-limit" => $this->property('tweet-limit'), "exclude-replies" => $this->property('exclude-replies')]);
     } catch (Exception $ex) {
         return [];
     }
     $this->page["tweets"] = $latestTweet;
 }
示例#2
0
 /**
  * Returns the favourite tweet feed.
  */
 public function all()
 {
     $favorites = TwitterClient::instance()->listFavorites();
     if (!$this->property('random')) {
         return array_slice($favorites, 0, $this->property('count'));
     }
     $randomKeys = array_rand($favorites, $this->property('count'));
     if (!is_array($randomKeys)) {
         $randomKeys = [$randomKeys];
     }
     $result = [];
     foreach ($randomKeys as $key) {
         $result[] = $favorites[$key];
     }
     return $result;
 }