You are here

public function TwitterAccount::__construct in Twitter 8

Constructor.

File

src/Plugin/Core/Entity/TwitterAccount.php, line 39

Class

TwitterAccount
Defines the twitter account entity class.

Namespace

Drupal\twitter\Plugin\Core\Entity

Code

public function __construct($values = []) {

  // Prepare values to match twitter_account table fields.
  if (!empty($values['id'])) {
    $values['twitter_uid'] = $values['id'];
    unset($values['id']);
  }
  if (!empty($values['created_at']) && ($created_time = strtotime($values['created_at']))) {
    $values['created_time'] = $created_time;
  }
  $values['utc_offset'] = isset($values['utc_offset']) ? $values['utc_offset'] : 0;
  if (isset($values['status'])) {
    $this->status = new TwitterStatus($values['status']);
    unset($values['status']);
  }
  parent::__construct($values, 'twitter_account');
}