toArray(); } elseif ($data instanceof Traversable) { $data = iterator_to_array($data); } } if (empty($data) || !is_array($data)) { #require_once 'Zend/Cloud/Infrastructure/Exception.php'; throw new Zend_Cloud_Infrastructure_Exception('You must pass an array of parameters'); } foreach ($this->attributeRequired as $key) { if (empty($data[$key])) { #require_once 'Zend/Cloud/Infrastructure/Exception.php'; throw new Zend_Cloud_Infrastructure_Exception(sprintf( 'The param "%s" is a required parameter for class %s', $key, __CLASS__ )); } } $this->attributes = $data; $this->adapter = $adapter; } /** * Get Attribute with a specific key * * @param array $data * @return misc|boolean */ public function getAttribute($key) { if (!empty($this->attributes[$key])) { return $this->attributes[$key]; } return false; } /** * Get all the attributes * * @return array */ public function getAttributes() { return $this->attributes; } /** * Get the image ID * * @return string */ public function getId() { return $this->attributes[self::IMAGE_ID]; } /** * Get the Owner ID * * @return string */ public function getOwnerId() { return $this->attributes[self::IMAGE_OWNERID]; } /** * Get the name * * @return string */ public function getName() { return $this->attributes[self::IMAGE_NAME]; } /** * Get the description * * @return string */ public function getDescription() { return $this->attributes[self::IMAGE_DESCRIPTION]; } /** * Get the platform * * @return string */ public function getPlatform() { return $this->attributes[self::IMAGE_PLATFORM]; } /** * Get the architecture * * @return string */ public function getArchitecture() { return $this->attributes[self::IMAGE_ARCHITECTURE]; } }