File: application/modules/extensions/aws/Aws/Api/MapShape.php

Recommend this page to a friend!
  Classes of Tran Tuan  >  Pretty PHP S3 Files Manager  >  application/modules/extensions/aws/Aws/Api/MapShape.php  >  Download  
File: application/modules/extensions/aws/Aws/Api/MapShape.php
Role: Application script
Content type: text/plain
Description: Application script
Class: Pretty PHP S3 Files Manager
Web based interface to manage files in Amazon S3
Author: By
Last change:
Date: 4 years ago
Size: 1,172 bytes
 

Contents

Class file image Download
<?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;
    }
}


For more information send a message to info at phpclasses dot org.