File indexing completed on 2025-03-02 05:29:46

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Service_Amazon
0017  * @subpackage SimpleDb
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id: Response.php 17539 2009-08-10 22:51:26Z mikaelkael $
0021  */
0022 
0023 /**
0024  * @category   Zend
0025  * @package    Zend_Service_Amazon
0026  * @subpackage SimpleDb
0027  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0028  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0029  */
0030 class Zend_Service_Amazon_SimpleDb_Attribute
0031 {
0032     protected $_itemName;
0033     protected $_name;
0034     protected $_values;
0035 
0036     /**
0037      * Constructor
0038      *
0039      * @param  string $itemName
0040      * @param  string $name
0041      * @param  array $values
0042      * @return void
0043      */
0044     function __construct($itemName, $name, $values)
0045     {
0046         $this->_itemName = $itemName;
0047         $this->_name     = $name;
0048 
0049         if (!is_array($values)) {
0050             $this->_values = array($values);
0051         } else {
0052             $this->_values = $values;
0053         }
0054     }
0055 
0056     /**
0057      * Return the item name to which the attribute belongs
0058      *
0059      * @return string
0060      */
0061     public function getItemName ()
0062     {
0063         return $this->_itemName;
0064     }
0065 
0066     /**
0067      * Retrieve attribute values
0068      *
0069      * @return array
0070      */
0071     public function getValues()
0072     {
0073         return $this->_values;
0074     }
0075 
0076     /**
0077      * Retrieve the attribute name
0078      *
0079      * @return string
0080      */
0081     public function getName ()
0082     {
0083         return $this->_name;
0084     }
0085 
0086     /**
0087      * Add value
0088      *
0089      * @param  mixed $value
0090      * @return void
0091      */
0092     public function addValue($value)
0093     {
0094         if (is_array($value)) {
0095              $this->_values += $value;
0096         } else {
0097             $this->_values[] = $value;
0098         }
0099     }
0100 
0101     public function setValues($values)
0102     {
0103         if (!is_array($values)) {
0104             $values = array($values);
0105         }
0106         $this->_values = $values;
0107     }
0108 }