Esempio n. 1
0
 public function getApi($key)
 {
     /** @var AbstractApi $api */
     $api = null;
     switch ($key) {
         case 'vk':
             $api = new vk();
             break;
         case 'facebook':
             $api = new facebook();
             break;
         case 'twitter':
             $api = new twitter();
             break;
         case 'google':
             $api = new google();
             break;
         default:
             return null;
     }
     $api->loadConfig(Config::instance()->apiConfig($key));
     return $api;
 }
Esempio n. 2
0
 /**
  * Creates a single instance for SN_POSTER and makes sure only one instance is present in memory.
  *
  * @return SN_POSTER_Manager
  */
 public static function instance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
         self::$instance->setup();
         self::$instance->config = Config::instance();
         self::$instance->factory = ApiFactory::instance();
     }
     return self::$instance;
 }