| 1 |
<?php |
| 2 |
namespace Aws\Api; |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
class Shape extends AbstractModel |
| 8 |
{ |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
public static function create(array $definition, ShapeMap $shapeMap) |
| 19 |
{ |
| 20 |
static $map = [ |
| 21 |
'structure' => StructureShape::class, |
| 22 |
'map' => MapShape::class, |
| 23 |
'list' => ListShape::class, |
| 24 |
'timestamp' => TimestampShape::class, |
| 25 |
'integer' => Shape::class, |
| 26 |
'double' => Shape::class, |
| 27 |
'float' => Shape::class, |
| 28 |
'long' => Shape::class, |
| 29 |
'string' => Shape::class, |
| 30 |
'byte' => Shape::class, |
| 31 |
'character' => Shape::class, |
| 32 |
'blob' => Shape::class, |
| 33 |
'boolean' => Shape::class |
| 34 |
]; |
| 35 |
|
| 36 |
if (isset($definition['shape'])) { |
| 37 |
return $shapeMap->resolve($definition); |
| 38 |
} |
| 39 |
|
| 40 |
if (!isset($map[$definition['type']])) { |
| 41 |
throw new \RuntimeException('Invalid type: ' |
| 42 |
. print_r($definition, true)); |
| 43 |
} |
| 44 |
|
| 45 |
$type = $map[$definition['type']]; |
| 46 |
|
| 47 |
return new $type($definition, $shapeMap); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public function getType() |
| 56 |
{ |
| 57 |
return $this->definition['type']; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public function getName() |
| 66 |
{ |
| 67 |
return $this->definition['name']; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
public function getContextParam() |
| 74 |
{ |
| 75 |
return $this->contextParam; |
| 76 |
} |
| 77 |
} |