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 / BidList.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.5 KB  |  66 lines

  1. <?PHP
  2. /**
  3.  * Model for a list of bids
  4.  *
  5.  * $Id: BidList.php,v 1.1 2005/01/11 23:49:06 luckec Exp $
  6.  *
  7.  * @package Services_Ebay
  8.  * @author  Carsten Lucke <luckec@php.net>
  9.  */
  10. class Services_Ebay_Model_BidList extends Services_Ebay_Model implements IteratorAggregate
  11. {
  12.    /**
  13.     * bids
  14.     *
  15.     * @var  array
  16.     */
  17.     private $bids = array();
  18.     
  19.     /**
  20.      * Number of bids in the bid-list
  21.      * 
  22.      * @var integer
  23.      */
  24.     private $count = 0;
  25.     
  26.    /**
  27.     * create new feedback model
  28.     *
  29.     * @param    array   feedback
  30.     */
  31.     public function __construct($bids, $session = null)
  32.     {
  33.         $this->count = (integer)$bids['Bids']['Count'];
  34.         
  35.         if (isset($bids['Bids']['Bid'])) {
  36.             if (!isset($bids['Bids']['Bid'][0])) {
  37.                 $bids['Bids']['Bid'] = array($bids['Bids']['Bid']);
  38.             }
  39.             foreach ($bids['Bids']['Bid'] as $tmp) {
  40.                 array_push($this->bids, Services_Ebay::loadModel('Bid', $tmp, $session));
  41.             }
  42.             unset($bids['Bids']);
  43.         }
  44.         parent::__construct($bids);
  45.     }
  46.     
  47.    /**
  48.     * iterate through the transactions
  49.     *
  50.     * @return array
  51.     */
  52.     public function getIterator()
  53.     {
  54.         return new ArrayObject($this->bids);
  55.     }
  56.     
  57.     /**
  58.      * Returns the number of bids, the bid-list contains.
  59.      * 
  60.      * @return integer  number of bids
  61.      */
  62.     public function getCount() {
  63.         return $this->count;
  64.     }
  65. }
  66. ?>