PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
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 / Shape.php

Shape.php in Media Cloud Sync 1.4.1, at includes/sdk/s3/Aws/Api/Shape.php

57 lines 1.6 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 * Base class representing a modeled shape.
7 */
8 class Shape extends AbstractModel
9 {
10 /**
11 * Get a concrete shape for the given definition.
12 *
13 * @param array $definition
14 * @param ShapeMap $shapeMap
15 *
16 * @return mixed
17 * @throws \RuntimeException if the type is invalid
18 */
19 public static function create(array $definition, ShapeMap $shapeMap)
20 {
21 static $map = ['structure' => StructureShape::class, 'map' => MapShape::class, 'list' => ListShape::class, 'timestamp' => TimestampShape::class, 'integer' => Shape::class, 'double' => Shape::class, 'float' => Shape::class, 'long' => Shape::class, 'string' => Shape::class, 'byte' => Shape::class, 'character' => Shape::class, 'blob' => Shape::class, 'boolean' => Shape::class];
22 if (isset($definition['shape'])) {
23 return $shapeMap->resolve($definition);
24 }
25 if (!isset($map[$definition['type']])) {
26 throw new \RuntimeException('Invalid type: ' . \print_r($definition, \true));
27 }
28 $type = $map[$definition['type']];
29 return new $type($definition, $shapeMap);
30 }
31 /**
32 * Get the type of the shape
33 *
34 * @return string
35 */
36 public function getType()
37 {
38 return $this->definition['type'];
39 }
40 /**
41 * Get the name of the shape
42 *
43 * @return string
44 */
45 public function getName()
46 {
47 return $this->definition['name'];
48 }
49 /**
50 * Get a context param definition.
51 */
52 public function getContextParam()
53 {
54 return $this->contextParam;
55 }
56 }
57