mirror of https://github.com/helloxz/imgurl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
958 B
46 lines
958 B
<?php |
|
/** |
|
* Some settings for SDK. |
|
*/ |
|
namespace QcloudImage; |
|
|
|
/** |
|
* Conf class. |
|
*/ |
|
class Conf { |
|
private static $VERSION = '1.0.0'; |
|
private static $SERVER_ADDR = 'service.image.myqcloud.com'; |
|
private static $HEADER_HOST = 'service.image.myqcloud.com'; |
|
private $REQ_TIMEOUT = 60; |
|
private $SCHEME = 'http'; |
|
|
|
public function useHttp() { |
|
$this->SCHEME = 'http'; |
|
} |
|
public function useHttps() { |
|
$this->SCHEME = 'https'; |
|
} |
|
public function setTimeout($timeout) { |
|
if ($timeout > 0) { |
|
$this->REQ_TIMEOUT = $timeout; |
|
} |
|
} |
|
public function timeout() { |
|
return $this->REQ_TIMEOUT; |
|
} |
|
public function host() { |
|
return self::$HEADER_HOST; |
|
} |
|
|
|
public function buildUrl($uri) { |
|
return $this->SCHEME.'://'.self::$SERVER_ADDR.'/'.ltrim($uri, "/"); |
|
} |
|
|
|
public static function getUa($appid = null) { |
|
$ua = 'CIPhpSDK/'.self::$VERSION.' ('.php_uname().')'; |
|
if ($appid) { |
|
$ua .= " User($appid)"; |
|
} |
|
return $ua; |
|
} |
|
}
|
|
|