web/lib/Zend/Service/Amazon/SimpleDb/Attribute.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Service_Amazon
       
    17  * @subpackage SimpleDb
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: Response.php 17539 2009-08-10 22:51:26Z mikaelkael $
       
    21  */
       
    22 
       
    23 /**
       
    24  * @category   Zend
       
    25  * @package    Zend_Service_Amazon
       
    26  * @subpackage SimpleDb
       
    27  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    28  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    29  */
       
    30 class Zend_Service_Amazon_SimpleDb_Attribute
       
    31 {
       
    32     protected $_itemName;
       
    33     protected $_name;
       
    34     protected $_values;
       
    35 
       
    36     /**
       
    37      * Constructor
       
    38      * 
       
    39      * @param  string $itemName 
       
    40      * @param  string $name 
       
    41      * @param  array $values 
       
    42      * @return void
       
    43      */
       
    44     function __construct($itemName, $name, $values) 
       
    45     {
       
    46         $this->_itemName = $itemName;
       
    47         $this->_name     = $name;
       
    48 
       
    49         if (!is_array($values)) {
       
    50             $this->_values = array($values);
       
    51         } else {
       
    52             $this->_values = $values;
       
    53         }
       
    54     }
       
    55 
       
    56 	/**
       
    57      * Return the item name to which the attribute belongs
       
    58      *
       
    59      * @return string
       
    60      */
       
    61     public function getItemName ()
       
    62     {
       
    63         return $this->_itemName;
       
    64     }
       
    65 
       
    66 	/**
       
    67      * Retrieve attribute values
       
    68      *
       
    69      * @return array
       
    70      */
       
    71     public function getValues()
       
    72     {
       
    73         return $this->_values;
       
    74     }
       
    75 
       
    76 	/**
       
    77      * Retrieve the attribute name
       
    78      *
       
    79      * @return string
       
    80      */
       
    81     public function getName ()
       
    82     {
       
    83         return $this->_name;
       
    84     }
       
    85     
       
    86     /**
       
    87      * Add value
       
    88      * 
       
    89      * @param  mixed $value 
       
    90      * @return void
       
    91      */
       
    92     public function addValue($value)
       
    93     {
       
    94         if (is_array($value)) {
       
    95              $this->_values += $value;   
       
    96         } else {
       
    97             $this->_values[] = $value;
       
    98         }
       
    99     }
       
   100 
       
   101     public function setValues($values)
       
   102     {
       
   103         if (!is_array($values)) {
       
   104             $values = array($values);
       
   105         }
       
   106         $this->_values = $values;
       
   107     }
       
   108 }