/** * Add a service */ public function addService($service, $version = false) { $apiConfig = Config::getAll(); if ($this->authenticated) { throw new \GoogleApi\Exception('Cant add services after having authenticated'); } $this->services[$service] = array(); if (isset($apiConfig['services'][$service])) { // Merge the service descriptor with the default values $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]); } }
/** * Instantiates the class, but does not initiate the login flow, leaving it * to the discretion of the caller (which is done by calling authenticate()). */ public function __construct() { $apiConfig = Config::getAll(); if (!empty($apiConfig['developer_key'])) { $this->developerKey = $apiConfig['developer_key']; } if (!empty($apiConfig['oauth2_client_id'])) { $this->clientId = $apiConfig['oauth2_client_id']; } if (!empty($apiConfig['oauth2_client_secret'])) { $this->clientSecret = $apiConfig['oauth2_client_secret']; } if (!empty($apiConfig['oauth2_redirect_uri'])) { $this->redirectUri = $apiConfig['oauth2_redirect_uri']; } if (!empty($apiConfig['oauth2_access_type'])) { $this->accessType = $apiConfig['oauth2_access_type']; } if (!empty($apiConfig['oauth2_approval_prompt'])) { $this->approvalPrompt = $apiConfig['oauth2_approval_prompt']; } }