/** * @return string Return base url of user's account. */ public static function getBaseUrl() { return User::getInstance()->getApiUrl(); }
public function testCanGetUserAppUrl() { $user = User::getInstance(); echo $user->getApiUrl(); }
/** * @param $json */ public static function injectOAuthToken($json) { User::getInstance()->oAuthToken = new Authorization\OAuthToken($json); }
/** * Get the authorization header string. * @throws \Exception * @return string */ private function getAuthorizationHeader() { // Get configuration. $config = Config::getInstance(); $user = User::getInstance(); // Return basic http string if (AuthType::BASIC_HTTP == $config->authenticationType) { $userpass = "******"; $string = base64_encode($userpass); return "Authorization: Basic {$string}"; } // Return oauth bearer if (AuthType::OAUTH == $config->authenticationType) { if (!isset($user->oAuthToken->access_token)) { throw new \Exception('An OAuth token Must be injected into the library!'); } return "Authorization: Bearer {$user->oAuthToken->access_token}"; } return false; }