oauth = $oauth; $this->options = isset($options) ? $options : new JRegistry; $this->client = isset($client) ? $client : new JHttp($this->options); // Setup the default API url if not already set. $this->options->def('api.url', 'https://api.linkedin.com'); } /** * Magic method to lazily create API objects * * @param string $name Name of property to retrieve * * @return JLinkedinObject Linkedin API object (statuses, users, favorites, etc.). * * @since 13.1 * @throws InvalidArgumentException */ public function __get($name) { $class = 'JLinkedin' . ucfirst($name); if (class_exists($class)) { if (false == isset($this->$name)) { $this->$name = new $class($this->options, $this->client, $this->oauth); } return $this->$name; } throw new InvalidArgumentException(sprintf('Argument %s produced an invalid class name: %s', $name, $class)); } /** * Get an option from the JLinkedin instance. * * @param string $key The name of the option to get. * * @return mixed The option value. * * @since 13.1 */ public function getOption($key) { return $this->options->get($key); } /** * Set an option for the Linkedin instance. * * @param string $key The name of the option to set. * @param mixed $value The option value to set. * * @return JLinkedin This object for method chaining. * * @since 13.1 */ public function setOption($key, $value) { $this->options->set($key, $value); return $this; } }