You are here

class InstagramConf in Drupagram 6

Same name and namespace in other branches
  1. 7 drupagram.lib.php \InstagramConf

Class InstagramConf

Singleton which stores common configuration

Hierarchy

Expanded class hierarchy of InstagramConf

File

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

View source
class InstagramConf {
  private static $instance;
  private $attributes = array(
    'apibase' => 'https://api.instagram.com',
    'apiurl' => 'https://api.instagram.com/v1',
    'tiny_url' => 'tinyurl.com',
  );
  public function __construct() {
  }
  public static function instance() {
    if (!isset(self::$instance)) {
      $className = __CLASS__;
      self::$instance = new $className();
    }
    return self::$instance;
  }

  /**
   * Generic getter
   *
   * @param $attribute
   *   string attribute name to return
   * @return
   *   mixed value or NULL
   */
  public function get($attribute) {
    if (array_key_exists($attribute, $this->attributes)) {
      return $this->attributes[$attribute];
    }
  }

  /**
   * Generic setter
   * @param $attribute
   *   string attribute name to be set
   * @param $value
   *   mixed value
   */
  public function set($attribute, $value) {
    if (array_key_exists($attribute, $this->attributes)) {
      $this->attributes[$attribute] = $value;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InstagramConf::$attributes private property
InstagramConf::$instance private static property
InstagramConf::get public function Generic getter
InstagramConf::instance public static function
InstagramConf::set public function Generic setter
InstagramConf::__construct public function