class TwitterConf in Twitter 6.3
Class TwitterConfig
Singleton which stores common configuration
Hierarchy
- class \TwitterConf
Expanded class hierarchy of TwitterConf
See also
http://php.net/manual/en/language.oop5.patterns.php
File
- ./
twitter.lib.php, line 13 - Classes to implement the full Twitter API
View source
class TwitterConf {
private static $instance;
private $attributes = array(
'host' => 'twitter.com',
'api' => 'api.twitter.com',
'search' => 'search.twitter.com',
'tiny_url' => 'tinyurl.com',
);
private 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TwitterConf:: |
private | property | ||
TwitterConf:: |
private static | property | ||
TwitterConf:: |
public | function | Generic getter | |
TwitterConf:: |
public static | function | ||
TwitterConf:: |
public | function | Generic setter | |
TwitterConf:: |
private | function |