mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 13:23:47 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
54
aws/Aws/Api/MapShape.php
Normal file
54
aws/Aws/Api/MapShape.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
namespace Aws\Api;
|
||||
|
||||
/**
|
||||
* Represents a map shape.
|
||||
*/
|
||||
class MapShape extends Shape
|
||||
{
|
||||
/** @var Shape */
|
||||
private $value;
|
||||
|
||||
/** @var Shape */
|
||||
private $key;
|
||||
|
||||
public function __construct(array $definition, ShapeMap $shapeMap)
|
||||
{
|
||||
$definition['type'] = 'map';
|
||||
parent::__construct($definition, $shapeMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Shape
|
||||
* @throws \RuntimeException if no value is specified
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
if (!$this->value) {
|
||||
if (!isset($this->definition['value'])) {
|
||||
throw new \RuntimeException('No value specified');
|
||||
}
|
||||
|
||||
$this->value = Shape::create(
|
||||
$this->definition['value'],
|
||||
$this->shapeMap
|
||||
);
|
||||
}
|
||||
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Shape
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
if (!$this->key) {
|
||||
$this->key = isset($this->definition['key'])
|
||||
? Shape::create($this->definition['key'], $this->shapeMap)
|
||||
: new Shape(['type' => 'string'], $this->shapeMap);
|
||||
}
|
||||
|
||||
return $this->key;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue