예제 #1
0
 /**
  * Rewind the \Iterator to the first element (\Iterator interface)
  *
  * @return void
  */
 public function rewind()
 {
     $this->_file->seek(0);
     $this->_getNextRow();
     // skip first line with the header
     parent::rewind();
 }
 /**
  * ArrayAdapter constructor.
  * @param array $data
  */
 public function __construct($data)
 {
     $this->_array = $data;
     $this->_position = 0;
     $colnames = array_keys($this->current());
     parent::__construct($colnames);
 }
예제 #3
0
 /**
  * Read the row pattern to determine which columns are dynamic, set the collection size
  *
  * @param Pattern $rowPattern
  * @param int $count how many records to generate
  */
 public function __construct(Pattern $rowPattern, $count)
 {
     $this->_pattern = $rowPattern;
     $this->_count = $count;
     $this->_patternRowsCount = $this->_pattern->getRowsCount();
     $this->_limit = (int) $count * $this->_patternRowsCount;
     parent::__construct($this->_pattern->getHeaders());
 }
예제 #4
0
 /**
  * Read the row pattern to determine which columns are dynamic, set the collection size
  *
  * @param array $rowPattern
  * @param int $limit how many records to generate
  */
 public function __construct(array $rowPattern, $limit)
 {
     foreach ($rowPattern as $key => $value) {
         if (is_callable($value) || is_string($value) && false !== strpos($value, '%s')) {
             $this->_dynamicColumns[$key] = $value;
         }
     }
     $this->_pattern = $rowPattern;
     $this->_limit = (int) $limit;
     parent::__construct(array_keys($rowPattern));
 }
 /**
  * @expectedException \OutOfBoundsException
  */
 public function testSeekableInterfaceException()
 {
     $this->_model->seek(0);
 }