private function format(Shape $shape, $value) { switch ($shape['type']) { case 'structure': $data = []; foreach ($value as $k => $v) { if ($v !== null && $shape->hasMember($k)) { $valueShape = $shape->getMember($k); $data[$valueShape['locationName'] ?: $k] = $this->format($valueShape, $v); } } return $data; case 'list': $items = $shape->getMember(); foreach ($value as &$v) { $v = $this->format($items, $v); } return $value; case 'map': if (empty($value)) { return new \stdClass(); } $values = $shape->getValue(); foreach ($value as &$v) { $v = $this->format($values, $v); } return $value; case 'blob': return base64_encode($value); case 'timestamp': return TimestampShape::format($value, 'unixTimestamp'); default: return $value; } }
private function applyHeader($name, Shape $member, $value, array &$opts) { if ($member->getType() == 'timestamp') { $value = TimestampShape::format($value, 'rfc822'); } $opts['headers'][$member['locationName'] ?: $name] = $value; }
protected function format_timestamp(TimestampShape $shape, $value, $prefix, array &$query) { $query[$prefix] = TimestampShape::format($value, 'iso8601'); }
private function add_timestamp(TimestampShape $shape, $name, $value, XMLWriter $xml) { $this->startElement($shape, $name, $xml); $xml->writeRaw(TimestampShape::format($value, 'iso8601')); $xml->endElement(); }