private function parse_list(ListShape $shape, \SimpleXMLElement $value)
 {
     $target = [];
     $member = $shape->getMember();
     if (!$shape['flattened']) {
         $value = $value->{$member['locationName'] ?: 'member'};
     }
     foreach ($value as $v) {
         $target[] = $this->dispatch($member, $v);
     }
     return $target;
 }
Example #2
0
 protected function format_list(ListShape $shape, array $value, $prefix, &$query)
 {
     // Handle empty list serialization
     if (!$value) {
         $query[$prefix] = false;
     } else {
         $items = $shape->getMember();
         foreach ($value as $k => $v) {
             $this->format($items, $v, $prefix . '.' . ($k + 1), $query);
         }
     }
 }
 private function check_list(ListShape $shape, $value)
 {
     if (!is_array($value)) {
         $this->addError('must be an array. Found ' . Aws\describe_type($value));
         return;
     }
     $items = $shape->getMember();
     foreach ($value as $index => $v) {
         $this->path[] = $index;
         $this->dispatch($items, $v);
         array_pop($this->path);
     }
 }
Example #4
0
 private function add_list(ListShape $shape, $name, array $value, \XMLWriter $xml)
 {
     $items = $shape->getMember();
     if ($shape['flattened']) {
         $elementName = $name;
     } else {
         $this->startElement($shape, $name, $xml);
         $elementName = $items['locationName'] ?: 'member';
     }
     foreach ($value as &$v) {
         $this->format($items, $elementName, $v, $xml);
     }
     if (!$shape['flattened']) {
         $xml->endElement();
     }
 }
 protected function format_list(ListShape $shape, array $value, $prefix, &$query)
 {
     // Handle empty list serialization
     if (!$value) {
         $query[$prefix] = '';
         return;
     }
     $items = $shape->getMember();
     if (!$this->isFlat($shape)) {
         $prefix .= '.member';
     } elseif ($name = $this->queryName($items)) {
         $parts = explode('.', $prefix);
         $parts[count($parts) - 1] = $name;
         $prefix = implode('.', $parts);
     }
     foreach ($value as $k => $v) {
         $this->format($items, $v, $prefix . '.' . ($k + 1), $query);
     }
 }
Example #6
0
 private function check_list(ListShape $shape, $value)
 {
     if (!is_array($value)) {
         $this->addError('must be an array. Found ' . Aws\describe_type($value));
         return;
     }
     list($min, $max, $count) = [$shape['min'], $shape['max'], count($value)];
     if ($min && $count < $min) {
         $this->addError("must have at least {$min} members." . " Value provided has {$count}.");
     }
     if ($max && $count > $max) {
         $this->addError("must have no more than {$max} members." . " Value provided has {$count}.");
     }
     $items = $shape->getMember();
     foreach ($value as $index => $v) {
         $this->path[] = $index;
         $this->dispatch($items, $v);
         array_pop($this->path);
     }
 }