Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Service/Yahoo/ResultSet.php
Go to the documentation of this file.
00001 <?php
00002 
00032 class Zend_Service_Yahoo_ResultSet implements SeekableIterator
00033 {
00039     public $totalResultsAvailable;
00040 
00046     public $totalResultsReturned;
00047 
00053     public $firstResultPosition;
00054 
00060     protected $_results;
00061 
00067     protected $_dom;
00068 
00074     protected $_xpath;
00075 
00081     protected $_currentIndex = 0;
00082 
00083 
00090     public function __construct(DOMDocument $dom)
00091     {
00092         $this->totalResultsAvailable = (int) $dom->documentElement->getAttribute('totalResultsAvailable');
00093         $this->totalResultsReturned = (int) $dom->documentElement->getAttribute('totalResultsReturned');
00094         $this->firstResultPosition = (int) $dom->documentElement->getAttribute('firstResultPosition');
00095 
00096         $this->_dom = $dom;
00097         $this->_xpath = new DOMXPath($dom);
00098 
00099         $this->_xpath->registerNamespace('yh', $this->_namespace);
00100 
00101         $this->_results = $this->_xpath->query('//yh:Result');
00102     }
00103 
00104 
00110     public function totalResults()
00111     {
00112         return $this->totalResultsReturned;
00113     }
00114 
00115 
00124     public function current()
00125     {
00129         require_once 'Zend/Service/Exception.php';
00130         throw new Zend_Service_Exception('Zend_Service_Yahoo_ResultSet::current() must be implemented by child '
00131                                        . 'classes');
00132     }
00133 
00134 
00140     public function key()
00141     {
00142         return $this->_currentIndex;
00143     }
00144 
00145 
00151     public function next()
00152     {
00153         $this->_currentIndex += 1;
00154     }
00155 
00156 
00162     public function rewind()
00163     {
00164         $this->_currentIndex = 0;
00165     }
00166 
00167 
00175     public function seek($index)
00176     {
00177         $indexInt = (int) $index;
00178         if ($indexInt >= 0 && $indexInt < $this->_results->length) {
00179             $this->_currentIndex = $indexInt;
00180         } else {
00181             throw new OutOfBoundsException("Illegal index '$index'");
00182         }
00183     }
00184 
00185 
00191     public function valid()
00192     {
00193         return $this->_currentIndex < $this->_results->length;
00194     }
00195 }
 All Data Structures Namespaces Files Functions Variables Enumerations