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.
55 lines
1.1 KiB
55 lines
1.1 KiB
<?php
|
|
/**
|
|
* Some settings for SDK.
|
|
*/
|
|
namespace QcloudImage;
|
|
|
|
/**
|
|
* Conf class.
|
|
*/
|
|
class Conf {
|
|
const VERSION = '2.0.0';
|
|
const SERVER_ADDR = 'service.image.myqcloud.com';
|
|
const SERVER_ADDR2 = 'recognition.image.myqcloud.com';
|
|
|
|
private $HOST = self::SERVER_ADDR2;
|
|
private $REQ_TIMEOUT = 60;
|
|
private $SCHEME = 'https';
|
|
|
|
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 useNewDomain()
|
|
{
|
|
$this->HOST = self::SERVER_ADDR2;
|
|
}
|
|
|
|
public function useOldDomain()
|
|
{
|
|
$this->HOST = self::SERVER_ADDR;
|
|
}
|
|
public function timeout() {
|
|
return $this->REQ_TIMEOUT;
|
|
}
|
|
|
|
public function buildUrl($uri) {
|
|
return $this->SCHEME . '://' . $this->HOST . '/' . ltrim($uri, "/");
|
|
}
|
|
|
|
public static function getUa($appid = null) {
|
|
$ua = 'CIPhpSDK/'.self::VERSION.' ('.php_uname().')';
|
|
if ($appid) {
|
|
$ua .= " User($appid)";
|
|
}
|
|
return $ua;
|
|
}
|
|
}
|
|
|