/**
  * Recorre cada uno de los registros de la colección
  * y recupera unicamente los que tengan todos los datos válidos.
  *
  * @access protected
  * @param  RowCollection $collection
  * @return array
  */
 protected function recuperaValidos(RowCollection $collection)
 {
     $validos = array();
     foreach ($collection->toArray() as $k => $r) {
         $validation = $this->valdarFila($r);
         if ($validation->passes() === true) {
             $validos[] = $r;
         }
     }
     return array_unique_recursive($validos);
 }
 /**
  *  Parse the rows
  * @return RowCollection
  */
 protected function parseRows()
 {
     // Set empty parsedRow array
     $parsedRows = new RowCollection();
     // set sheet title
     $parsedRows->setTitle($this->excel->getActiveSheet()->getTitle());
     // Get the start row
     $startRow = $this->getStartRow();
     try {
         $rows = $this->worksheet->getRowIterator($startRow);
     } catch (PHPExcel_Exception $e) {
         $rows = [];
     }
     // Loop through the rows inside the worksheet
     foreach ($rows as $this->row) {
         // Limit the results when needed
         if ($this->hasReachedLimit()) {
             break;
         }
         // Push the parsed cells inside the parsed rows
         $parsedRows->push($this->parseCells());
         // Count the rows
         $this->currentRow++;
     }
     // Return the parsed array
     return $parsedRows;
 }
Example #3
0
 /**
  * Recorre cada uno de los registros de la colección
  * y recupera unicamente los que tengan todos los datos válidos.
  *
  * @access protected
  * @param  RowCollection $collection
  * @return array
  */
 protected function getValid(RowCollection $collection)
 {
     $validated = array();
     foreach ($collection->toArray() as $k => $r) {
         if ($this->validateSingleRow($r)->passes() === true) {
             $validated[] = $r;
         }
     }
     return array_unique_recursive($validated);
 }