初始化仓库
This commit is contained in:
53
vendor/alibabacloud/client/src/Accept.php
vendored
Normal file
53
vendor/alibabacloud/client/src/Accept.php
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace AlibabaCloud\Client;
|
||||
|
||||
/**
|
||||
* Class Accept
|
||||
*
|
||||
* @package AlibabaCloud\Client
|
||||
*/
|
||||
class Accept
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $format;
|
||||
|
||||
/**
|
||||
* Accept constructor.
|
||||
*
|
||||
* @param string $format
|
||||
*/
|
||||
private function __construct($format)
|
||||
{
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $format
|
||||
*
|
||||
* @return Accept
|
||||
*/
|
||||
public static function create($format)
|
||||
{
|
||||
return new static($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$key = \strtoupper($this->format);
|
||||
|
||||
$list = [
|
||||
'JSON' => 'application/json',
|
||||
'XML' => 'application/xml',
|
||||
'RAW' => 'application/octet-stream',
|
||||
'FORM' => 'application/x-www-form-urlencoded'
|
||||
];
|
||||
|
||||
return isset($list[$key]) ? $list[$key] : $list['RAW'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user