| 1 |
<?php |
| 2 |
namespace Aws\Api; |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
class MapShape extends Shape |
| 8 |
{ |
| 9 |
|
| 10 |
private $value; |
| 11 |
|
| 12 |
|
| 13 |
private $key; |
| 14 |
|
| 15 |
public function __construct(array $definition, ShapeMap $shapeMap) |
| 16 |
{ |
| 17 |
$definition['type'] = 'map'; |
| 18 |
parent::__construct($definition, $shapeMap); |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
public function getValue() |
| 26 |
{ |
| 27 |
if (!$this->value) { |
| 28 |
if (!isset($this->definition['value'])) { |
| 29 |
throw new \RuntimeException('No value specified'); |
| 30 |
} |
| 31 |
|
| 32 |
$this->value = Shape::create( |
| 33 |
$this->definition['value'], |
| 34 |
$this->shapeMap |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
return $this->value; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
public function getKey() |
| 45 |
{ |
| 46 |
if (!$this->key) { |
| 47 |
$this->key = isset($this->definition['key']) |
| 48 |
? Shape::create($this->definition['key'], $this->shapeMap) |
| 49 |
: new Shape(['type' => 'string'], $this->shapeMap); |
| 50 |
} |
| 51 |
|
| 52 |
return $this->key; |
| 53 |
} |
| 54 |
} |