in src/OSS/OssClient.php [162:230]
private function __initNewClient($config = array())
{
$isCName = isset($config['cname']) ? $config['cname'] : false;
$endpoint = isset($config['endpoint']) ? $config['endpoint'] : '';
$requestProxy = isset($config['request_proxy']) ? $config['request_proxy'] : null;
$provider = isset($config['provider']) ? $config['provider'] : '';
if (empty($endpoint)) {
throw new OssException("endpoint is empty");
}
$this->hostname = $this->checkEndpoint($endpoint, $isCName);
if (isset($config['forcePathStyle'])) {
if ($config['forcePathStyle'] === true) {
$this->hostType = self::OSS_HOST_TYPE_PATH_STYLE;
}
}
$this->requestProxy = $requestProxy;
if (!$provider instanceof CredentialsProvider) {
throw new OssException("provider must be an instance of CredentialsProvider");
}
$this->provider = $provider;
$this->region = isset($config['region']) ? $config['region'] : '';
$this->cloudBoxId = isset($config['cloudBoxId']) ? $config['cloudBoxId'] : '';
// $enableStrictObjName
$this->enableStrictObjName = true;
if (isset($config['strictObjectName'])) {
if ($config['strictObjectName'] === false) {
$this->enableStrictObjName = false;
}
}
// sign version
$signatureVersion = self::OSS_SIGNATURE_VERSION_V1;
if (isset($config['signatureVersion']) && $config['signatureVersion'] === self::OSS_SIGNATURE_VERSION_V4) {
$signatureVersion = self::OSS_SIGNATURE_VERSION_V4;
}
if ($signatureVersion === self::OSS_SIGNATURE_VERSION_V4) {
$this->enableStrictObjName = false;
$this->signer = new SignerV4();
} else {
$this->signer = new SignerV1();
}
//checkObjectEncoding
$this->checkObjectEncoding = false;
if (isset($config['checkObjectEncoding'])) {
if ($config['checkObjectEncoding'] === true) {
$this->checkObjectEncoding = true;
}
}
//filePathCompatible
$this->filePathCompatible = false;
if (version_compare(phpversion(), '7.0.0', '<')) {
if (OssUtil::isWin()) {
$this->filePathCompatible = true;
}
}
if (isset($config['filePathCompatible'])) {
if ($config['filePathCompatible'] === true) {
$this->filePathCompatible = true;
} else if ($config['filePathCompatible'] === false) {
$this->filePathCompatible = false;
}
}
self::checkEnv();
}