name); return new $class($options); } /** * @var string required parameters */ protected $required = array( 'profile', ); /** * Sets the API data. * * @param array API options * @return void */ public function __construct(array $options = NULL) { foreach ($this->required as $key) { if ( ! isset($options[$key])) { throw new Kohana_OAuth_Exception('Required option not passed: :option', array(':option' => $key)); } $this->$key = $options[$key]; } } /** * Return the value of any protected class variable. * * // Get the API details * $secret = $api->id; * * @param string variable name * @return mixed */ public function __get($key) { return $this->$key; } /** * Returns the API key. * * @return string */ public function __toString() { return (string) $this->profile; } } // End OAuth_API