You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
31
vendor/oss-sdk/src/OSS/Result/AclResult.php
vendored
Executable file
31
vendor/oss-sdk/src/OSS/Result/AclResult.php
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
/**
|
||||
* The type of the return value of getBucketAcl, it wraps the data parsed from xml.
|
||||
*
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class AclResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @throws OssException
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
if (empty($content)) {
|
||||
throw new OssException("body is null");
|
||||
}
|
||||
$xml = simplexml_load_string($content);
|
||||
if (isset($xml->AccessControlList->Grant)) {
|
||||
return strval($xml->AccessControlList->Grant);
|
||||
} else {
|
||||
throw new OssException("xml format exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
27
vendor/oss-sdk/src/OSS/Result/AppendResult.php
vendored
Executable file
27
vendor/oss-sdk/src/OSS/Result/AppendResult.php
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
/**
|
||||
* Class AppendResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class AppendResult extends Result
|
||||
{
|
||||
/**
|
||||
* Get the value of next-append-position from append's response headers
|
||||
*
|
||||
* @return int
|
||||
* @throws OssException
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$header = $this->rawResponse->header;
|
||||
if (isset($header["x-oss-next-append-position"])) {
|
||||
return intval($header["x-oss-next-append-position"]);
|
||||
}
|
||||
throw new OssException("cannot get next-append-position");
|
||||
}
|
||||
}
|
||||
19
vendor/oss-sdk/src/OSS/Result/BodyResult.php
vendored
Executable file
19
vendor/oss-sdk/src/OSS/Result/BodyResult.php
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
/**
|
||||
* Class BodyResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class BodyResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
return empty($this->rawResponse->body) ? "" : $this->rawResponse->body;
|
||||
}
|
||||
}
|
||||
21
vendor/oss-sdk/src/OSS/Result/CallbackResult.php
vendored
Executable file
21
vendor/oss-sdk/src/OSS/Result/CallbackResult.php
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
/**
|
||||
* Class CallbackResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class CallbackResult extends PutSetDeleteResult
|
||||
{
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 && (int)(intval($status)) !== 203) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
30
vendor/oss-sdk/src/OSS/Result/CopyObjectResult.php
vendored
Executable file
30
vendor/oss-sdk/src/OSS/Result/CopyObjectResult.php
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
/**
|
||||
* Class CopyObjectResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class CopyObjectResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return array()
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$body = $this->rawResponse->body;
|
||||
$xml = simplexml_load_string($body);
|
||||
$result = array();
|
||||
|
||||
if (isset($xml->LastModified)) {
|
||||
$result[] = $xml->LastModified;
|
||||
}
|
||||
if (isset($xml->ETag)) {
|
||||
$result[] = $xml->ETag;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
27
vendor/oss-sdk/src/OSS/Result/DeleteObjectsResult.php
vendored
Executable file
27
vendor/oss-sdk/src/OSS/Result/DeleteObjectsResult.php
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
/**
|
||||
* Class DeleteObjectsResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class DeleteObjectsResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return array()
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$body = $this->rawResponse->body;
|
||||
$xml = simplexml_load_string($body);
|
||||
$objects = array();
|
||||
|
||||
if (isset($xml->Deleted)) {
|
||||
foreach($xml->Deleted as $deleteKey)
|
||||
$objects[] = $deleteKey->Key;
|
||||
}
|
||||
return $objects;
|
||||
}
|
||||
}
|
||||
34
vendor/oss-sdk/src/OSS/Result/ExistResult.php
vendored
Executable file
34
vendor/oss-sdk/src/OSS/Result/ExistResult.php
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
/**
|
||||
* Class ExistResult checks if bucket or object exists, according to the http status in response headers.
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class ExistResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
return intval($this->rawResponse->status) === 200 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the response status is OK according to the http status code.
|
||||
* [200-299]: OK; [404]: Not found. It means the object or bucket is not found--it's a valid response too.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
19
vendor/oss-sdk/src/OSS/Result/GetCnameResult.php
vendored
Executable file
19
vendor/oss-sdk/src/OSS/Result/GetCnameResult.php
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\CnameConfig;
|
||||
|
||||
class GetCnameResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return CnameConfig
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$config = new CnameConfig();
|
||||
$config->parseFromXml($content);
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
34
vendor/oss-sdk/src/OSS/Result/GetCorsResult.php
vendored
Executable file
34
vendor/oss-sdk/src/OSS/Result/GetCorsResult.php
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\CorsConfig;
|
||||
|
||||
class GetCorsResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return CorsConfig
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$config = new CorsConfig();
|
||||
$config->parseFromXml($content);
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the response is OK, according to the http status. [200-299]:OK, the Cors config could be got; [404]: not found--no Cors config.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
41
vendor/oss-sdk/src/OSS/Result/GetLifecycleResult.php
vendored
Executable file
41
vendor/oss-sdk/src/OSS/Result/GetLifecycleResult.php
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
use OSS\Model\LifecycleConfig;
|
||||
|
||||
/**
|
||||
* Class GetLifecycleResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class GetLifecycleResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse the LifecycleConfig object from the response
|
||||
*
|
||||
* @return LifecycleConfig
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$config = new LifecycleConfig();
|
||||
$config->parseFromXml($content);
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the response is OK according to the http status.
|
||||
* [200-299]: OK, and the LifecycleConfig could be got; [404] The Life cycle config is not found.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
19
vendor/oss-sdk/src/OSS/Result/GetLiveChannelHistoryResult.php
vendored
Executable file
19
vendor/oss-sdk/src/OSS/Result/GetLiveChannelHistoryResult.php
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\GetLiveChannelHistory;
|
||||
|
||||
class GetLiveChannelHistoryResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$channelList = new GetLiveChannelHistory();
|
||||
$channelList->parseFromXml($content);
|
||||
return $channelList;
|
||||
}
|
||||
}
|
||||
19
vendor/oss-sdk/src/OSS/Result/GetLiveChannelInfoResult.php
vendored
Executable file
19
vendor/oss-sdk/src/OSS/Result/GetLiveChannelInfoResult.php
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\GetLiveChannelInfo;
|
||||
|
||||
class GetLiveChannelInfoResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$channelList = new GetLiveChannelInfo();
|
||||
$channelList->parseFromXml($content);
|
||||
return $channelList;
|
||||
}
|
||||
}
|
||||
19
vendor/oss-sdk/src/OSS/Result/GetLiveChannelStatusResult.php
vendored
Executable file
19
vendor/oss-sdk/src/OSS/Result/GetLiveChannelStatusResult.php
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\GetLiveChannelStatus;
|
||||
|
||||
class GetLiveChannelStatusResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$channelList = new GetLiveChannelStatus();
|
||||
$channelList->parseFromXml($content);
|
||||
return $channelList;
|
||||
}
|
||||
}
|
||||
30
vendor/oss-sdk/src/OSS/Result/GetLocationResult.php
vendored
Executable file
30
vendor/oss-sdk/src/OSS/Result/GetLocationResult.php
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
/**
|
||||
* Class GetLocationResult getBucketLocation interface returns the result class, encapsulated
|
||||
* The returned xml data is parsed
|
||||
*
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class GetLocationResult extends Result
|
||||
{
|
||||
|
||||
/**
|
||||
* Parse data from response
|
||||
*
|
||||
* @return string
|
||||
* @throws OssException
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
if (empty($content)) {
|
||||
throw new OssException("body is null");
|
||||
}
|
||||
$xml = simplexml_load_string($content);
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
41
vendor/oss-sdk/src/OSS/Result/GetLoggingResult.php
vendored
Executable file
41
vendor/oss-sdk/src/OSS/Result/GetLoggingResult.php
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\LoggingConfig;
|
||||
|
||||
|
||||
/**
|
||||
* Class GetLoggingResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class GetLoggingResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse LoggingConfig data
|
||||
*
|
||||
* @return LoggingConfig
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$config = new LoggingConfig();
|
||||
$config->parseFromXml($content);
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface,
|
||||
* 404 is also considered a valid response
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
41
vendor/oss-sdk/src/OSS/Result/GetRefererResult.php
vendored
Executable file
41
vendor/oss-sdk/src/OSS/Result/GetRefererResult.php
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
use OSS\Model\RefererConfig;
|
||||
|
||||
/**
|
||||
* Class GetRefererResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class GetRefererResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse RefererConfig data
|
||||
*
|
||||
* @return RefererConfig
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$config = new RefererConfig();
|
||||
$config->parseFromXml($content);
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface,
|
||||
* 404 is also considered a valid response
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
34
vendor/oss-sdk/src/OSS/Result/GetStorageCapacityResult.php
vendored
Executable file
34
vendor/oss-sdk/src/OSS/Result/GetStorageCapacityResult.php
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
/**
|
||||
* Class AclResult GetBucketAcl interface returns the result class, encapsulated
|
||||
* The returned xml data is parsed
|
||||
*
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class GetStorageCapacityResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse data from response
|
||||
*
|
||||
* @return string
|
||||
* @throws OssException
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
if (empty($content)) {
|
||||
throw new OssException("body is null");
|
||||
}
|
||||
$xml = simplexml_load_string($content);
|
||||
if (isset($xml->StorageCapacity)) {
|
||||
return intval($xml->StorageCapacity);
|
||||
} else {
|
||||
throw new OssException("xml format exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
40
vendor/oss-sdk/src/OSS/Result/GetWebsiteResult.php
vendored
Executable file
40
vendor/oss-sdk/src/OSS/Result/GetWebsiteResult.php
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\WebsiteConfig;
|
||||
|
||||
/**
|
||||
* Class GetWebsiteResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class GetWebsiteResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse WebsiteConfig data
|
||||
*
|
||||
* @return WebsiteConfig
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$config = new WebsiteConfig();
|
||||
$config->parseFromXml($content);
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface,
|
||||
* 404 is also considered a valid response
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
23
vendor/oss-sdk/src/OSS/Result/HeaderResult.php
vendored
Executable file
23
vendor/oss-sdk/src/OSS/Result/HeaderResult.php
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
/**
|
||||
* Class HeaderResult
|
||||
* @package OSS\Result
|
||||
* @link https://docs.aliyun.com/?spm=5176.383663.13.7.HgUIqL#/pub/oss/api-reference/object&GetObjectMeta
|
||||
*/
|
||||
class HeaderResult extends Result
|
||||
{
|
||||
/**
|
||||
* The returned ResponseCore header is used as the return data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
return empty($this->rawResponse->header) ? array() : $this->rawResponse->header;
|
||||
}
|
||||
|
||||
}
|
||||
29
vendor/oss-sdk/src/OSS/Result/InitiateMultipartUploadResult.php
vendored
Executable file
29
vendor/oss-sdk/src/OSS/Result/InitiateMultipartUploadResult.php
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
|
||||
/**
|
||||
* Class initiateMultipartUploadResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class InitiateMultipartUploadResult extends Result
|
||||
{
|
||||
/**
|
||||
* Get uploadId in result and return
|
||||
*
|
||||
* @throws OssException
|
||||
* @return string
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$xml = simplexml_load_string($content);
|
||||
if (isset($xml->UploadId)) {
|
||||
return strval($xml->UploadId);
|
||||
}
|
||||
throw new OssException("cannot get UploadId");
|
||||
}
|
||||
}
|
||||
33
vendor/oss-sdk/src/OSS/Result/ListBucketsResult.php
vendored
Executable file
33
vendor/oss-sdk/src/OSS/Result/ListBucketsResult.php
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\BucketInfo;
|
||||
use OSS\Model\BucketListInfo;
|
||||
|
||||
/**
|
||||
* Class ListBucketsResult
|
||||
*
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class ListBucketsResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return BucketListInfo
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$bucketList = array();
|
||||
$content = $this->rawResponse->body;
|
||||
$xml = new \SimpleXMLElement($content);
|
||||
if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) {
|
||||
foreach ($xml->Buckets->Bucket as $bucket) {
|
||||
$bucketInfo = new BucketInfo(strval($bucket->Location),
|
||||
strval($bucket->Name),
|
||||
strval($bucket->CreationDate));
|
||||
$bucketList[] = $bucketInfo;
|
||||
}
|
||||
}
|
||||
return new BucketListInfo($bucketList);
|
||||
}
|
||||
}
|
||||
16
vendor/oss-sdk/src/OSS/Result/ListLiveChannelResult.php
vendored
Executable file
16
vendor/oss-sdk/src/OSS/Result/ListLiveChannelResult.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\LiveChannelListInfo;
|
||||
|
||||
class ListLiveChannelResult extends Result
|
||||
{
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$channelList = new LiveChannelListInfo();
|
||||
$channelList->parseFromXml($content);
|
||||
return $channelList;
|
||||
}
|
||||
}
|
||||
55
vendor/oss-sdk/src/OSS/Result/ListMultipartUploadResult.php
vendored
Executable file
55
vendor/oss-sdk/src/OSS/Result/ListMultipartUploadResult.php
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssUtil;
|
||||
use OSS\Model\ListMultipartUploadInfo;
|
||||
use OSS\Model\UploadInfo;
|
||||
|
||||
|
||||
/**
|
||||
* Class ListMultipartUploadResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class ListMultipartUploadResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse the return data from the ListMultipartUpload interface
|
||||
*
|
||||
* @return ListMultipartUploadInfo
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$xml = simplexml_load_string($content);
|
||||
|
||||
$encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : "";
|
||||
$bucket = isset($xml->Bucket) ? strval($xml->Bucket) : "";
|
||||
$keyMarker = isset($xml->KeyMarker) ? strval($xml->KeyMarker) : "";
|
||||
$keyMarker = OssUtil::decodeKey($keyMarker, $encodingType);
|
||||
$uploadIdMarker = isset($xml->UploadIdMarker) ? strval($xml->UploadIdMarker) : "";
|
||||
$nextKeyMarker = isset($xml->NextKeyMarker) ? strval($xml->NextKeyMarker) : "";
|
||||
$nextKeyMarker = OssUtil::decodeKey($nextKeyMarker, $encodingType);
|
||||
$nextUploadIdMarker = isset($xml->NextUploadIdMarker) ? strval($xml->NextUploadIdMarker) : "";
|
||||
$delimiter = isset($xml->Delimiter) ? strval($xml->Delimiter) : "";
|
||||
$delimiter = OssUtil::decodeKey($delimiter, $encodingType);
|
||||
$prefix = isset($xml->Prefix) ? strval($xml->Prefix) : "";
|
||||
$prefix = OssUtil::decodeKey($prefix, $encodingType);
|
||||
$maxUploads = isset($xml->MaxUploads) ? intval($xml->MaxUploads) : 0;
|
||||
$isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : "";
|
||||
$listUpload = array();
|
||||
|
||||
if (isset($xml->Upload)) {
|
||||
foreach ($xml->Upload as $upload) {
|
||||
$key = isset($upload->Key) ? strval($upload->Key) : "";
|
||||
$key = OssUtil::decodeKey($key, $encodingType);
|
||||
$uploadId = isset($upload->UploadId) ? strval($upload->UploadId) : "";
|
||||
$initiated = isset($upload->Initiated) ? strval($upload->Initiated) : "";
|
||||
$listUpload[] = new UploadInfo($key, $uploadId, $initiated);
|
||||
}
|
||||
}
|
||||
return new ListMultipartUploadInfo($bucket, $keyMarker, $uploadIdMarker,
|
||||
$nextKeyMarker, $nextUploadIdMarker,
|
||||
$delimiter, $prefix, $maxUploads, $isTruncated, $listUpload);
|
||||
}
|
||||
}
|
||||
71
vendor/oss-sdk/src/OSS/Result/ListObjectsResult.php
vendored
Executable file
71
vendor/oss-sdk/src/OSS/Result/ListObjectsResult.php
vendored
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssUtil;
|
||||
use OSS\Model\ObjectInfo;
|
||||
use OSS\Model\ObjectListInfo;
|
||||
use OSS\Model\PrefixInfo;
|
||||
|
||||
/**
|
||||
* Class ListObjectsResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class ListObjectsResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse the xml data returned by the ListObjects interface
|
||||
*
|
||||
* return ObjectListInfo
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$xml = new \SimpleXMLElement($this->rawResponse->body);
|
||||
$encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : "";
|
||||
$objectList = $this->parseObjectList($xml, $encodingType);
|
||||
$prefixList = $this->parsePrefixList($xml, $encodingType);
|
||||
$bucketName = isset($xml->Name) ? strval($xml->Name) : "";
|
||||
$prefix = isset($xml->Prefix) ? strval($xml->Prefix) : "";
|
||||
$prefix = OssUtil::decodeKey($prefix, $encodingType);
|
||||
$marker = isset($xml->Marker) ? strval($xml->Marker) : "";
|
||||
$marker = OssUtil::decodeKey($marker, $encodingType);
|
||||
$maxKeys = isset($xml->MaxKeys) ? intval($xml->MaxKeys) : 0;
|
||||
$delimiter = isset($xml->Delimiter) ? strval($xml->Delimiter) : "";
|
||||
$delimiter = OssUtil::decodeKey($delimiter, $encodingType);
|
||||
$isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : "";
|
||||
$nextMarker = isset($xml->NextMarker) ? strval($xml->NextMarker) : "";
|
||||
$nextMarker = OssUtil::decodeKey($nextMarker, $encodingType);
|
||||
return new ObjectListInfo($bucketName, $prefix, $marker, $nextMarker, $maxKeys, $delimiter, $isTruncated, $objectList, $prefixList);
|
||||
}
|
||||
|
||||
private function parseObjectList($xml, $encodingType)
|
||||
{
|
||||
$retList = array();
|
||||
if (isset($xml->Contents)) {
|
||||
foreach ($xml->Contents as $content) {
|
||||
$key = isset($content->Key) ? strval($content->Key) : "";
|
||||
$key = OssUtil::decodeKey($key, $encodingType);
|
||||
$lastModified = isset($content->LastModified) ? strval($content->LastModified) : "";
|
||||
$eTag = isset($content->ETag) ? strval($content->ETag) : "";
|
||||
$type = isset($content->Type) ? strval($content->Type) : "";
|
||||
$size = isset($content->Size) ? intval($content->Size) : 0;
|
||||
$storageClass = isset($content->StorageClass) ? strval($content->StorageClass) : "";
|
||||
$retList[] = new ObjectInfo($key, $lastModified, $eTag, $type, $size, $storageClass);
|
||||
}
|
||||
}
|
||||
return $retList;
|
||||
}
|
||||
|
||||
private function parsePrefixList($xml, $encodingType)
|
||||
{
|
||||
$retList = array();
|
||||
if (isset($xml->CommonPrefixes)) {
|
||||
foreach ($xml->CommonPrefixes as $commonPrefix) {
|
||||
$prefix = isset($commonPrefix->Prefix) ? strval($commonPrefix->Prefix) : "";
|
||||
$prefix = OssUtil::decodeKey($prefix, $encodingType);
|
||||
$retList[] = new PrefixInfo($prefix);
|
||||
}
|
||||
}
|
||||
return $retList;
|
||||
}
|
||||
}
|
||||
42
vendor/oss-sdk/src/OSS/Result/ListPartsResult.php
vendored
Executable file
42
vendor/oss-sdk/src/OSS/Result/ListPartsResult.php
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\ListPartsInfo;
|
||||
use OSS\Model\PartInfo;
|
||||
|
||||
|
||||
/**
|
||||
* Class ListPartsResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class ListPartsResult extends Result
|
||||
{
|
||||
/**
|
||||
* Parse the xml data returned by the ListParts interface
|
||||
*
|
||||
* @return ListPartsInfo
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$xml = simplexml_load_string($content);
|
||||
$bucket = isset($xml->Bucket) ? strval($xml->Bucket) : "";
|
||||
$key = isset($xml->Key) ? strval($xml->Key) : "";
|
||||
$uploadId = isset($xml->UploadId) ? strval($xml->UploadId) : "";
|
||||
$nextPartNumberMarker = isset($xml->NextPartNumberMarker) ? intval($xml->NextPartNumberMarker) : "";
|
||||
$maxParts = isset($xml->MaxParts) ? intval($xml->MaxParts) : "";
|
||||
$isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : "";
|
||||
$partList = array();
|
||||
if (isset($xml->Part)) {
|
||||
foreach ($xml->Part as $part) {
|
||||
$partNumber = isset($part->PartNumber) ? intval($part->PartNumber) : "";
|
||||
$lastModified = isset($part->LastModified) ? strval($part->LastModified) : "";
|
||||
$eTag = isset($part->ETag) ? strval($part->ETag) : "";
|
||||
$size = isset($part->Size) ? intval($part->Size) : "";
|
||||
$partList[] = new PartInfo($partNumber, $lastModified, $eTag, $size);
|
||||
}
|
||||
}
|
||||
return new ListPartsInfo($bucket, $key, $uploadId, $nextPartNumberMarker, $maxParts, $isTruncated, $partList);
|
||||
}
|
||||
}
|
||||
16
vendor/oss-sdk/src/OSS/Result/PutLiveChannelResult.php
vendored
Executable file
16
vendor/oss-sdk/src/OSS/Result/PutLiveChannelResult.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Model\LiveChannelInfo;
|
||||
|
||||
class PutLiveChannelResult extends Result
|
||||
{
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$content = $this->rawResponse->body;
|
||||
$channel = new LiveChannelInfo();
|
||||
$channel->parseFromXml($content);
|
||||
return $channel;
|
||||
}
|
||||
}
|
||||
20
vendor/oss-sdk/src/OSS/Result/PutSetDeleteResult.php
vendored
Executable file
20
vendor/oss-sdk/src/OSS/Result/PutSetDeleteResult.php
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
|
||||
/**
|
||||
* Class PutSetDeleteResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class PutSetDeleteResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return array()
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$body = array('body' => $this->rawResponse->body);
|
||||
return array_merge($this->rawResponse->header, $body);
|
||||
}
|
||||
}
|
||||
175
vendor/oss-sdk/src/OSS/Result/Result.php
vendored
Executable file
175
vendor/oss-sdk/src/OSS/Result/Result.php
vendored
Executable file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
use OSS\Http\ResponseCore;
|
||||
|
||||
|
||||
/**
|
||||
* Class Result, The result class of The operation of the base class, different requests in dealing with the return of data have different logic,
|
||||
* The specific parsing logic postponed to subclass implementation
|
||||
*
|
||||
* @package OSS\Model
|
||||
*/
|
||||
abstract class Result
|
||||
{
|
||||
/**
|
||||
* Result constructor.
|
||||
* @param $response ResponseCore
|
||||
* @throws OssException
|
||||
*/
|
||||
public function __construct($response)
|
||||
{
|
||||
if ($response === null) {
|
||||
throw new OssException("raw response is null");
|
||||
}
|
||||
$this->rawResponse = $response;
|
||||
$this->parseResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get requestId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRequestId()
|
||||
{
|
||||
if (isset($this->rawResponse) &&
|
||||
isset($this->rawResponse->header) &&
|
||||
isset($this->rawResponse->header['x-oss-request-id'])
|
||||
) {
|
||||
return $this->rawResponse->header['x-oss-request-id'];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the returned data, different request returns the data format is different
|
||||
*
|
||||
* $return mixed
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->parsedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclass implementation, different requests return data has different analytical logic, implemented by subclasses
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function parseDataFromResponse();
|
||||
|
||||
/**
|
||||
* Whether the operation is successful
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function isOK()
|
||||
{
|
||||
return $this->isOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws OssException
|
||||
*/
|
||||
public function parseResponse()
|
||||
{
|
||||
$this->isOk = $this->isResponseOk();
|
||||
if ($this->isOk) {
|
||||
$this->parsedData = $this->parseDataFromResponse();
|
||||
} else {
|
||||
$httpStatus = strval($this->rawResponse->status);
|
||||
$requestId = strval($this->getRequestId());
|
||||
$code = $this->retrieveErrorCode($this->rawResponse->body);
|
||||
$message = $this->retrieveErrorMessage($this->rawResponse->body);
|
||||
$body = $this->rawResponse->body;
|
||||
|
||||
$details = array(
|
||||
'status' => $httpStatus,
|
||||
'request-id' => $requestId,
|
||||
'code' => $code,
|
||||
'message' => $message,
|
||||
'body' => $body
|
||||
);
|
||||
throw new OssException($details);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get the error message from body
|
||||
*
|
||||
* @param $body
|
||||
* @return string
|
||||
*/
|
||||
private function retrieveErrorMessage($body)
|
||||
{
|
||||
if (empty($body) || false === strpos($body, '<?xml')) {
|
||||
return '';
|
||||
}
|
||||
$xml = simplexml_load_string($body);
|
||||
if (isset($xml->Message)) {
|
||||
return strval($xml->Message);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get the error Code from body
|
||||
*
|
||||
* @param $body
|
||||
* @return string
|
||||
*/
|
||||
private function retrieveErrorCode($body)
|
||||
{
|
||||
if (empty($body) || false === strpos($body, '<?xml')) {
|
||||
return '';
|
||||
}
|
||||
$xml = simplexml_load_string($body);
|
||||
if (isset($xml->Code)) {
|
||||
return strval($xml->Code);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Judging from the return http status code, [200-299] that is OK
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isResponseOk()
|
||||
{
|
||||
$status = $this->rawResponse->status;
|
||||
if ((int)(intval($status) / 100) == 2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the original return data
|
||||
*
|
||||
* @return ResponseCore
|
||||
*/
|
||||
public function getRawResponse()
|
||||
{
|
||||
return $this->rawResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate whether the request is successful
|
||||
*/
|
||||
protected $isOk = false;
|
||||
/**
|
||||
* Data parsed by subclasses
|
||||
*/
|
||||
protected $parsedData = null;
|
||||
/**
|
||||
* Store the original Response returned by the auth function
|
||||
*
|
||||
* @var ResponseCore
|
||||
*/
|
||||
protected $rawResponse;
|
||||
}
|
||||
24
vendor/oss-sdk/src/OSS/Result/SymlinkResult.php
vendored
Executable file
24
vendor/oss-sdk/src/OSS/Result/SymlinkResult.php
vendored
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
use OSS\OssClient;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class SymlinkResult extends Result
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @throws OssException
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$this->rawResponse->header[OssClient::OSS_SYMLINK_TARGET] = rawurldecode($this->rawResponse->header[OssClient::OSS_SYMLINK_TARGET]);
|
||||
return $this->rawResponse->header;
|
||||
}
|
||||
}
|
||||
|
||||
28
vendor/oss-sdk/src/OSS/Result/UploadPartResult.php
vendored
Executable file
28
vendor/oss-sdk/src/OSS/Result/UploadPartResult.php
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace OSS\Result;
|
||||
|
||||
use OSS\Core\OssException;
|
||||
|
||||
/**
|
||||
* Class UploadPartResult
|
||||
* @package OSS\Result
|
||||
*/
|
||||
class UploadPartResult extends Result
|
||||
{
|
||||
/**
|
||||
* 结果中part的ETag
|
||||
*
|
||||
* @return string
|
||||
* @throws OssException
|
||||
*/
|
||||
protected function parseDataFromResponse()
|
||||
{
|
||||
$header = $this->rawResponse->header;
|
||||
if (isset($header["etag"])) {
|
||||
return $header["etag"];
|
||||
}
|
||||
throw new OssException("cannot get ETag");
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user