You are here

public function InstagramMedia::__construct in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.lib.php \InstagramMedia::__construct()

Constructor for InstagramMedia

File

./drupagram.lib.php, line 602
Classes to implement the full Instagram API

Class

InstagramMedia
Class for containing an individual Instagram posts.

Code

public function __construct($values = array()) {

  // Filter out null and empty values
  $values = array_filter($values);

  // Turn values into object attributes
  foreach ($values as $key => $value) {
    switch ($key) {
      case 'user':
        $this->user = new InstagramUser($values['user']);
        break;

      // case 'caption':
      // $this->caption = $values['caption']['text'];
      // break;
      default:
        $this->{$key} = $value;
        break;
    }
  }
}