/** * Returns a Host object configured with the three standard Dropbox host: "api.dropbox.com", * "api-content.dropbox.com", and "www.dropbox.com" * * @return Dropbox_Host */ public static function getDefault() { if (!self::$defaultValue) { self::$defaultValue = new self("api.dropbox.com", "api-content.dropbox.com", "www.dropbox.com"); } return self::$defaultValue; }
/** * Constructor. * * @param string $key * See {@link getKey()} * @param string $secret * See {@link getSecret()} */ public function __construct($key, $secret) { self::checkKeyArg($key); self::checkSecretArg($secret); $this->key = $key; $this->secret = $secret; // The $host parameter is sort of internal. We don't include it in the param list because // we don't want it to be included in the documentation. Use PHP arg list hacks to get at // it. $host = null; if (func_num_args() == 3) { $host = func_get_arg(2); Dropbox_Host::checkArgOrNull("host", $host); } if ($host === null) { $host = Dropbox_Host::getDefault(); } $this->host = $host; }
/** * Constructor. * * @param string $accessToken * See {@link getAccessToken()} * @param string $clientIdentifier * See {@link getClientIdentifier()} * @param null|string $userLocale * See {@link getUserLocale()} */ public function __construct($accessToken, $clientIdentifier, $userLocale = null) { self::checkAccessTokenArg("accessToken", $accessToken); self::checkClientIdentifierArg("clientIdentifier", $clientIdentifier); Dropbox_Checker::argStringNonEmptyOrNull("userLocale", $userLocale); $this->accessToken = $accessToken; $this->clientIdentifier = $clientIdentifier; $this->userLocale = $userLocale; // The $host parameter is sort of internal. We don't include it in the param list because // we don't want it to be included in the documentation. Use PHP arg list hacks to get at // it. $host = null; if (func_num_args() == 4) { $host = func_get_arg(3); Dropbox_Host::checkArgOrNull("host", $host); } if ($host === null) { $host = Dropbox_Host::getDefault(); } $this->host = $host; // These fields are redundant, but it makes these values a little more convenient // to access. $this->apiHost = $host->getApi(); $this->contentHost = $host->getContent(); }