You are here

public function TwitterStatus::__construct in Twitter 7.5

Same name and namespace in other branches
  1. 6.5 twitter.lib.php \TwitterStatus::__construct()
  2. 6.3 twitter.lib.php \TwitterStatus::__construct()
  3. 7.6 twitter.module \TwitterStatus::__construct()
  4. 7.3 twitter.lib.php \TwitterStatus::__construct()

Constructor for TwitterStatus

File

./twitter.lib.php, line 1387
Integration layer to communicate with the Twitter REST API 1.1. https://dev.twitter.com/docs/api/1.1

Class

TwitterStatus
Class for containing an individual twitter status.

Code

public function __construct($values = array()) {
  $this->created_at = $values['created_at'];
  $this->id = $values['id'];
  if (isset($values['full_text'])) {
    $this->text = $values['full_text'];
  }
  else {
    $this->text = $values['text'];
  }
  $this->source = $values['source'];
  $this->truncated = $values['truncated'];
  $this->favorited = $values['favorited'];
  $this->in_reply_to_status_id = $values['in_reply_to_status_id'];
  $this->in_reply_to_user_id = $values['in_reply_to_user_id'];
  $this->in_reply_to_screen_name = $values['in_reply_to_screen_name'];

  // This is not passed in for the first tweet added while attaching a new
  // account to the system.
  if (!empty($values['entities'])) {
    $this->entities = $values['entities'];
  }
  if (isset($values['user'])) {
    $this->user = new TwitterUser($values['user']);
  }

  // Load full retweeted_status (original tweet) if retweet detected.
  if (isset($values['retweeted_status'])) {
    $this->retweeted_status = new TwitterStatus($values['retweeted_status']);
  }
}