初始化仓库
This commit is contained in:
49
vendor/qcloud/cos-sdk-v5/src/Request/BodyLocation.php
vendored
Normal file
49
vendor/qcloud/cos-sdk-v5/src/Request/BodyLocation.php
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Qcloud\Cos\Request;
|
||||
|
||||
use GuzzleHttp\Command\Guzzle\RequestLocation\AbstractLocation;
|
||||
use GuzzleHttp\Command\CommandInterface;
|
||||
use GuzzleHttp\Command\Guzzle\Parameter;
|
||||
use GuzzleHttp\Psr7;
|
||||
use Psr\Http\Message\MessageInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Adds a raw/binary body to a request.
|
||||
* This is here because: https://github.com/guzzle/guzzle-services/issues/160
|
||||
*/
|
||||
class BodyLocation extends AbstractLocation
|
||||
{
|
||||
|
||||
/**
|
||||
* Set the name of the location
|
||||
*
|
||||
* @param string $locationName
|
||||
*/
|
||||
public function __construct($locationName = 'body')
|
||||
{
|
||||
parent::__construct($locationName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CommandInterface $command
|
||||
* @param RequestInterface $request
|
||||
* @param Parameter $param
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function visit(
|
||||
CommandInterface $command,
|
||||
RequestInterface $request,
|
||||
Parameter $param
|
||||
) {
|
||||
$value = $request->getBody()->getContents();
|
||||
if ('' !== $value) {
|
||||
throw new \RuntimeException('Only one "body" location may exist per operation');
|
||||
}
|
||||
// binary string data from bound parameter
|
||||
$value = $command[$param->getName()];
|
||||
return $request->withBody(Psr7\Utils::streamFor($value));
|
||||
}
|
||||
}
|
||||
20
vendor/qcloud/cos-sdk-v5/src/Request/XmlLocation.php
vendored
Normal file
20
vendor/qcloud/cos-sdk-v5/src/Request/XmlLocation.php
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Qcloud\Cos\Request;
|
||||
|
||||
use GuzzleHttp\Command\Guzzle\RequestLocation\XmlLocation as DefaultXmlLocation;
|
||||
|
||||
class XmlLocation extends DefaultXmlLocation
|
||||
{
|
||||
protected function writeElement(\XMLWriter $writer, $prefix, $name, $namespace, $value)
|
||||
{
|
||||
if ($namespace) {
|
||||
$writer->startElementNS($prefix, $name, $namespace);
|
||||
} else {
|
||||
$writer->startElement($name);
|
||||
}
|
||||
// Remove use writeCdata
|
||||
$writer->writeRaw($value);
|
||||
$writer->endElement();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user