Laravel version update
Laravel version update
This commit is contained in:
@@ -62,8 +62,8 @@ class JsonBody
|
||||
|
||||
case 'list':
|
||||
$items = $shape->getMember();
|
||||
foreach ($value as &$v) {
|
||||
$v = $this->format($items, $v);
|
||||
foreach ($value as $k => $v) {
|
||||
$value[$k] = $this->format($items, $v);
|
||||
}
|
||||
return $value;
|
||||
|
||||
@@ -72,8 +72,8 @@ class JsonBody
|
||||
return new \stdClass;
|
||||
}
|
||||
$values = $shape->getValue();
|
||||
foreach ($value as &$v) {
|
||||
$v = $this->format($values, $v);
|
||||
foreach ($value as $k => $v) {
|
||||
$value[$k] = $this->format($values, $v);
|
||||
}
|
||||
return $value;
|
||||
|
||||
@@ -81,7 +81,10 @@ class JsonBody
|
||||
return base64_encode($value);
|
||||
|
||||
case 'timestamp':
|
||||
return TimestampShape::format($value, 'unixTimestamp');
|
||||
$timestampFormat = !empty($shape['timestampFormat'])
|
||||
? $shape['timestampFormat']
|
||||
: 'unixTimestamp';
|
||||
return TimestampShape::format($value, $timestampFormat);
|
||||
|
||||
default:
|
||||
return $value;
|
||||
|
@@ -144,7 +144,10 @@ class QueryParamBuilder
|
||||
$prefix,
|
||||
array &$query
|
||||
) {
|
||||
$query[$prefix] = TimestampShape::format($value, 'iso8601');
|
||||
$timestampFormat = !empty($shape['timestampFormat'])
|
||||
? $shape['timestampFormat']
|
||||
: 'iso8601';
|
||||
$query[$prefix] = TimestampShape::format($value, $timestampFormat);
|
||||
}
|
||||
|
||||
protected function format_boolean(Shape $shape, $value, $prefix, array &$query)
|
||||
|
@@ -9,6 +9,8 @@ use Aws\Api\StructureShape;
|
||||
use Aws\Api\TimestampShape;
|
||||
use Aws\CommandInterface;
|
||||
use GuzzleHttp\Psr7;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use GuzzleHttp\Psr7\UriResolver;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
@@ -121,8 +123,20 @@ abstract class RestSerializer
|
||||
|
||||
private function applyHeader($name, Shape $member, $value, array &$opts)
|
||||
{
|
||||
if ($member->getType() == 'timestamp') {
|
||||
$value = TimestampShape::format($value, 'rfc822');
|
||||
if ($member->getType() === 'timestamp') {
|
||||
$timestampFormat = !empty($member['timestampFormat'])
|
||||
? $member['timestampFormat']
|
||||
: 'rfc822';
|
||||
$value = TimestampShape::format($value, $timestampFormat);
|
||||
}
|
||||
if ($member['jsonvalue']) {
|
||||
$value = json_encode($value);
|
||||
if (empty($value) && JSON_ERROR_NONE !== json_last_error()) {
|
||||
throw new \InvalidArgumentException('Unable to encode the provided value'
|
||||
. ' with \'json_encode\'. ' . json_last_error_msg());
|
||||
}
|
||||
|
||||
$value = base64_encode($value);
|
||||
}
|
||||
|
||||
$opts['headers'][$member['locationName'] ?: $name] = $value;
|
||||
@@ -146,10 +160,16 @@ abstract class RestSerializer
|
||||
? $opts['query'] + $value
|
||||
: $value;
|
||||
} elseif ($value !== null) {
|
||||
if ($member->getType() === 'boolean') {
|
||||
$type = $member->getType();
|
||||
if ($type === 'boolean') {
|
||||
$value = $value ? 'true' : 'false';
|
||||
} elseif ($type === 'timestamp') {
|
||||
$timestampFormat = !empty($member['timestampFormat'])
|
||||
? $member['timestampFormat']
|
||||
: 'iso8601';
|
||||
$value = TimestampShape::format($value, $timestampFormat);
|
||||
}
|
||||
|
||||
|
||||
$opts['query'][$member['locationName'] ?: $name] = $value;
|
||||
}
|
||||
}
|
||||
@@ -175,11 +195,13 @@ abstract class RestSerializer
|
||||
$k = $isGreedy ? substr($matches[1], 0, -1) : $matches[1];
|
||||
if (!isset($varspecs[$k])) {
|
||||
return '';
|
||||
} elseif ($isGreedy) {
|
||||
return str_replace('%2F', '/', rawurlencode($varspecs[$k]));
|
||||
} else {
|
||||
return rawurlencode($varspecs[$k]);
|
||||
}
|
||||
|
||||
if ($isGreedy) {
|
||||
return str_replace('%2F', '/', rawurlencode($varspecs[$k]));
|
||||
}
|
||||
|
||||
return rawurlencode($varspecs[$k]);
|
||||
},
|
||||
$operation['http']['requestUri']
|
||||
);
|
||||
@@ -192,6 +214,6 @@ abstract class RestSerializer
|
||||
|
||||
// Expand path place holders using Amazon's slightly different URI
|
||||
// template syntax.
|
||||
return Psr7\Uri::resolve($this->endpoint, $relative);
|
||||
return UriResolver::resolve($this->endpoint, new Uri($relative));
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ class XmlBody
|
||||
$xml = new XMLWriter();
|
||||
$xml->openMemory();
|
||||
$xml->startDocument('1.0', 'UTF-8');
|
||||
$this->format($shape, $shape['locationName'], $args, $xml);
|
||||
$this->format($shape, $shape['locationName'] ?: $shape['name'], $args, $xml);
|
||||
$xml->endDocument();
|
||||
|
||||
return $xml->outputMemory();
|
||||
@@ -142,7 +142,7 @@ class XmlBody
|
||||
$elementName = $items['locationName'] ?: 'member';
|
||||
}
|
||||
|
||||
foreach ($value as &$v) {
|
||||
foreach ($value as $v) {
|
||||
$this->format($items, $elementName, $v, $xml);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,10 @@ class XmlBody
|
||||
XMLWriter $xml
|
||||
) {
|
||||
$this->startElement($shape, $name, $xml);
|
||||
$xml->writeRaw(TimestampShape::format($value, 'iso8601'));
|
||||
$timestampFormat = !empty($shape['timestampFormat'])
|
||||
? $shape['timestampFormat']
|
||||
: 'iso8601';
|
||||
$xml->writeRaw(TimestampShape::format($value, $timestampFormat));
|
||||
$xml->endElement();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user