home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Services / Ebay / Model / TransactionList.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.5 KB  |  50 lines

  1. <?PHP
  2. /**
  3.  * Model for a list of transactions
  4.  *
  5.  * $Id: TransactionList.php,v 1.1 2004/10/28 17:14:53 schst Exp $
  6.  *
  7.  * @package Services_Ebay
  8.  * @author  Stephan Schmidt <schst@php.net>
  9.  * @todo    improve handling of transactions (possibly store the itemId in each transaction object)
  10.  * @todo    build seller object
  11.  */
  12. class Services_Ebay_Model_TransactionList extends Services_Ebay_Model implements IteratorAggregate
  13. {
  14.    /**
  15.     * transactions
  16.     *
  17.     * @var  array
  18.     */
  19.     private $transactions = array();
  20.     
  21.    /**
  22.     * create new feedback model
  23.     *
  24.     * @param    array   feedback
  25.     */
  26.     public function __construct($transactions, $session = null)
  27.     {
  28.         if (isset($transactions['Transactions']['Transaction'])) {
  29.             if (!isset($transactions['Transactions']['Transaction'][0])) {
  30.                 $transactions['Transactions']['Transaction'] = array( $transactions['Transactions']['Transaction'] );
  31.             }
  32.             foreach ($transactions['Transactions']['Transaction'] as $tmp) {
  33.                 array_push($this->transactions, Services_Ebay::loadModel('Transaction', $tmp, $session));
  34.             }
  35.             unset($transactions['Transactions']);
  36.         }
  37.         parent::__construct($transactions);
  38.     }
  39.     
  40.    /**
  41.     * iterate through the transactions
  42.     *
  43.     * @return array
  44.     */
  45.     public function getIterator()
  46.     {
  47.         return new ArrayObject($this->transactions);
  48.     }
  49. }
  50. ?>