Source for file linkedin.php

Documentation is available at linkedin.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Linkedin
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die();
  11.  
  12. /**
  13.  * Joomla Platform class for interacting with a Linkedin API instance.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  Linkedin
  17.  * @since       13.1
  18.  */
  19. class JLinkedin
  20. {
  21.     /**
  22.      * @var    JRegistry  Options for the Linkedin object.
  23.      * @since  13.1
  24.      */
  25.     protected $options;
  26.  
  27.     /**
  28.      * @var    JHttp  The HTTP client object to use in sending HTTP requests.
  29.      * @since  13.1
  30.      */
  31.     protected $client;
  32.  
  33.     /**
  34.      * @var JLinkedinOAuth The OAuth client.
  35.      * @since 13.1
  36.      */
  37.     protected $oauth;
  38.  
  39.     /**
  40.      * @var    JLinkedinPeople  Linkedin API object for people.
  41.      * @since  13.1
  42.      */
  43.     protected $people;
  44.  
  45.     /**
  46.      * @var    JLinkedinGroups  Linkedin API object for groups.
  47.      * @since  13.1
  48.      */
  49.     protected $groups;
  50.  
  51.     /**
  52.      * @var    JLinkedinCompanies  Linkedin API object for companies.
  53.      * @since  13.1
  54.      */
  55.     protected $companies;
  56.  
  57.     /**
  58.      * @var    JLinkedinJobs  Linkedin API object for jobs.
  59.      * @since  13.1
  60.      */
  61.     protected $jobs;
  62.  
  63.     /**
  64.      * @var    JLinkedinStream  Linkedin API object for social stream.
  65.      * @since  13.1
  66.      */
  67.     protected $stream;
  68.  
  69.     /**
  70.      * @var    JLinkedinCommunications  Linkedin API object for communications.
  71.      * @since  13.1
  72.      */
  73.     protected $communications;
  74.  
  75.     /**
  76.      * Constructor.
  77.      *
  78.      * @param   JLinkedinOauth  $oauth    OAuth object
  79.      * @param   JRegistry       $options  Linkedin options object.
  80.      * @param   JHttp           $client   The HTTP client object.
  81.      *
  82.      * @since   13.1
  83.      */
  84.     public function __construct(JLinkedinOauth $oauth nullJRegistry $options nullJHttp $client null)
  85.     {
  86.         $this->oauth = $oauth;
  87.         $this->options = isset($options$options new JRegistry;
  88.         $this->client  = isset($client$client new JHttp($this->options);
  89.  
  90.         // Setup the default API url if not already set.
  91.         $this->options->def('api.url''https://api.linkedin.com');
  92.     }
  93.  
  94.     /**
  95.      * Magic method to lazily create API objects
  96.      *
  97.      * @param   string  $name  Name of property to retrieve
  98.      *
  99.      * @return  JLinkedinObject  Linkedin API object (statuses, users, favorites, etc.).
  100.      *
  101.      * @since   13.1
  102.      * @throws  InvalidArgumentException
  103.      */
  104.     public function __get($name)
  105.     {
  106.         $class 'JLinkedin' ucfirst($name);
  107.  
  108.         if (class_exists($class))
  109.         {
  110.             if (false == isset($this->$name))
  111.             {
  112.                 $this->$name new $class($this->options$this->client$this->oauth);
  113.             }
  114.  
  115.             return $this->$name;
  116.         }
  117.  
  118.         throw new InvalidArgumentException(sprintf('Argument %s produced an invalid class name: %s'$name$class));
  119.     }
  120.  
  121.     /**
  122.      * Get an option from the JLinkedin instance.
  123.      *
  124.      * @param   string  $key  The name of the option to get.
  125.      *
  126.      * @return  mixed  The option value.
  127.      *
  128.      * @since   13.1
  129.      */
  130.     public function getOption($key)
  131.     {
  132.         return $this->options->get($key);
  133.     }
  134.  
  135.     /**
  136.      * Set an option for the Linkedin instance.
  137.      *
  138.      * @param   string  $key    The name of the option to set.
  139.      * @param   mixed   $value  The option value to set.
  140.      *
  141.      * @return  JLinkedin  This object for method chaining.
  142.      *
  143.      * @since   13.1
  144.      */
  145.     public function setOption($key$value)
  146.     {
  147.         $this->options->set($key$value);
  148.  
  149.         return $this;
  150.     }
  151. }

Documentation generated on Tue, 19 Nov 2013 15:07:09 +0100 by phpDocumentor 1.4.3