Services_Ebay
[ class tree: Services_Ebay ] [ index: Services_Ebay ] [ all elements ]

Source for file SearchResult.php

Documentation is available at SearchResult.php

  1. <?PHP
  2. /**
  3.  * Model for a search result
  4.  *
  5.  *
  6.  * @package Services_Ebay
  7.  * @author  Stephan Schmidt <schst@php.net>
  8.  */
  9. class Services_Ebay_Model_SearchResult extends Services_Ebay_Model implements IteratorAggregate
  10. {
  11.    /**
  12.     * items that have been found
  13.     *
  14.     * @var  array 
  15.     */
  16.     private $items = array();
  17.     
  18.    /**
  19.     * create new model
  20.     *
  21.     * @param    array 
  22.     * @param    object 
  23.     */
  24.     public function __construct($props$session = null)
  25.     {
  26.         if (isset($props['SearchResultItemArray']['SearchResultItem'])) {
  27.             $items $props['SearchResultItemArray']['SearchResultItem'];
  28.             unset($props['SearchResultItemArray']['SearchResultItem']);
  29.             if (isset($items[0])) {
  30.                 $items $items;
  31.             else {
  32.                 $items = array($items);
  33.             }
  34.             foreach ($items as $tmp{
  35.                 array_push($this->itemsServices_Ebay::loadModel('Item'$tmp['Item']$session));
  36.             }
  37.         }
  38.         parent::__construct($props$session);
  39.     }
  40.  
  41.    /**
  42.     * iterate through the items
  43.     *
  44.     * @return   object 
  45.     */
  46.     public function getIterator()
  47.     {
  48.         $it = new ArrayObject($this->items);
  49.         return $it;
  50.     }
  51. }
  52. ?>

Documentation generated on Mon, 11 Mar 2019 15:49:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.