Вход Регистрация
Файл: includes/library/aws/Aws/Api/Shape.php
Строк: 59
<?php
namespace AwsApi;

/**
 * Base class representing a modeled shape.
 */
class Shape extends AbstractModel
{
    
/**
     * Get a concrete shape for the given definition.
     *
     * @param array    $definition
     * @param ShapeMap $shapeMap
     *
     * @return mixed
     * @throws RuntimeException if the type is invalid
     */
    
public static function create(array $definitionShapeMap $shapeMap)
    {
        static 
$map = [
            
'structure' => 'AwsApiStructureShape',
            
'map'       => 'AwsApiMapShape',
            
'list'      => 'AwsApiListShape',
            
'timestamp' => 'AwsApiTimestampShape',
            
'integer'   => 'AwsApiShape',
            
'double'    => 'AwsApiShape',
            
'float'     => 'AwsApiShape',
            
'long'      => 'AwsApiShape',
            
'string'    => 'AwsApiShape',
            
'byte'      => 'AwsApiShape',
            
'character' => 'AwsApiShape',
            
'blob'      => 'AwsApiShape',
            
'boolean'   => 'AwsApiShape'
        
];

        if (isset(
$definition['shape'])) {
            return 
$shapeMap->resolve($definition);
        }

        if (!isset(
$map[$definition['type']])) {
            throw new 
RuntimeException('Invalid type: '
                
print_r($definitiontrue));
        }

        
$type $map[$definition['type']];

        return new 
$type($definition$shapeMap);
    }

    
/**
     * Get the type of the shape
     *
     * @return string
     */
    
public function getType()
    {
        return 
$this->definition['type'];
    }

    
/**
     * Get the name of the shape
     *
     * @return string
     */
    
public function getName()
    {
        return 
$this->definition['name'];
    }
}
Онлайн: 0
Реклама