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.
yanzong/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php

34 lines
841 B

<?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;
}
}