PluginProbe
Media Cloud Sync / 1.0.2
Media Cloud Sync v1.0.2
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / s3 / Aws / Api / MapShape.php

MapShape.php in Media Cloud Sync 1.0.2, at includes/sdk/s3/Aws/Api/MapShape.php

44 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws\Api;
4
5 /**
6 * Represents a map shape.
7 */
8 class MapShape extends Shape
9 {
10 /** @var Shape */
11 private $value;
12 /** @var Shape */
13 private $key;
14 public function __construct(array $definition, ShapeMap $shapeMap)
15 {
16 $definition['type'] = 'map';
17 parent::__construct($definition, $shapeMap);
18 }
19 /**
20 * @return Shape
21 * @throws \RuntimeException if no value is specified
22 */
23 public function getValue()
24 {
25 if (!$this->value) {
26 if (!isset($this->definition['value'])) {
27 throw new \RuntimeException('No value specified');
28 }
29 $this->value = Shape::create($this->definition['value'], $this->shapeMap);
30 }
31 return $this->value;
32 }
33 /**
34 * @return Shape
35 */
36 public function getKey()
37 {
38 if (!$this->key) {
39 $this->key = isset($this->definition['key']) ? Shape::create($this->definition['key'], $this->shapeMap) : new Shape(['type' => 'string'], $this->shapeMap);
40 }
41 return $this->key;
42 }
43 }
44