CFDBQueryResultIteratorFactory

The Contact Form DB CFDBQueryResultIteratorFactory class.

Defined (1)

The class is defined in the following location(s).

/CFDBQueryResultIteratorFactory.php  
  1. class CFDBQueryResultIteratorFactory { 
  2.  
  3. /** 
  4. * @var CFDBAbstractQueryResultsIterator mock instance 
  5. */ 
  6. var $mock; 
  7.  
  8. public static function getInstance() { 
  9. static $inst = null; 
  10. if ($inst === null) { 
  11. $inst = new CFDBQueryResultIteratorFactory(); 
  12. return $inst; 
  13.  
  14. /** 
  15. * @param $mock CFDBAbstractQueryResultsIterator mock for CFDBQueryResultIterator 
  16. */ 
  17. public function setQueryResultsIteratorMock($mock) { 
  18. $this->mock = $mock; 
  19.  
  20. public function clearMock() { 
  21. $this->mock = null; 
  22.  
  23. /** 
  24. * Factory method for getting a new CFDBQueryResultIterator or mock. 
  25. * @param $unbuffered bool 
  26. * @return CFDBAbstractQueryResultsIterator (or mock) 
  27. */ 
  28. public function newQueryIterator($unbuffered = false) { 
  29. if ($this->mock) { 
  30. return $this->mock; 
  31. if ($unbuffered) { 
  32. return new CFDBWpdbUnbufferedResultIterator; 
  33. } else { 
  34. return new CFDBWpdbResultIterator; 
  35.