apiKeys[$key] = $value; return $this; } /** * @param $key * @return string */ public function getApiKey($key) { return isset($this->apiKeys[$key]) ? $this->apiKeys[$key] : null; } /** * @param string $key * @param string $value * @return Configuration */ public function setApiKeyPrefix($key, $value) { $this->apiKeyPrefixes[$key] = $value; return $this; } /** * @param $key * @return string */ public function getApiKeyPrefix($key) { return isset($this->apiKeyPrefixes[$key]) ? $this->apiKeyPrefixes[$key] : null; } /** * @param string $username * @return Configuration */ public function setUsername($username) { $this->username = $username; return $this; } /** * @return string */ public function getUsername() { return $this->username; } /** * @param string $password * @return Configuration */ public function setPassword($password) { $this->password = $password; return $this; } /** * @return string */ public function getPassword() { return $this->password; } /** * add default header * * @param string $headerName header name (e.g. Token) * @param string $headerValue header value (e.g. 1z8wp3) * @return ApiClient */ public function addDefaultHeader($headerName, $headerValue) { if (!is_string($headerName)) { throw new \InvalidArgumentException('Header name must be a string.'); } $this->defaultHeaders[$headerName] = $headerValue; return $this; } /** * get the default header * * @return array default header */ public function getDefaultHeaders() { return $this->defaultHeaders; } /** * delete a default header * @param string $headerName the header to delete * @return Configuration */ public function deleteDefaultHeader($headerName) { unset($this->defaultHeaders[$headerName]); } /** * @param string $host * @return Configuration */ public function setHost($host) { $this->host = $host; return $this; } /** * @return string */ public function getHost() { return $this->host; } /** * set the user agent of the api client * * @param string $userAgent the user agent of the api client * @return ApiClient */ public function setUserAgent($userAgent) { if (!is_string($userAgent)) { throw new \InvalidArgumentException('User-agent must be a string.'); } $this->userAgent = $userAgent; return $this; } /** * get the user agent of the api client * * @return string user agent */ public function getUserAgent() { return $this->userAgent; } /** * set the HTTP timeout value * * @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] * @return ApiClient */ public function setCurlTimeout($seconds) { if (!is_numeric($seconds) || $seconds < 0) { throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.'); } $this->curlTimeout = $seconds; return $this; } /** * get the HTTP timeout value * * @return string HTTP timeout value */ public function getCurlTimeout() { return $this->curlTimeout; } /** * @param bool $debug * @return Configuration */ public function setDebug($debug) { $this->debug = $debug; return $this; } /** * @return bool */ public function getDebug() { return $this->debug; } /** * @param string $debugFile * @return Configuration */ public function setDebugFile($debugFile) { $this->debugFile = $debugFile; return $this; } /** * @return string */ public function getDebugFile() { return $this->debugFile; } /** * @return Configuration */ public static function getDefaultConfiguration() { if (self::$defaultConfiguration == null) { return new Configuration(); } return self::$defaultConfiguration; } public static function setDefaultConfiguration(Configuration $config) { self::$defaultConfiguration = $config; } }