/**
  * Method used by addRows to recursively parse cellValues into TableCellModels
  *
  * @see TableModel::addRows
  * @see TableCellModel
  * @param array $cells
  * @param bool $namedIndex
  * @return array containing TableCellModel objects
  * @throws \Exception
  */
 private function parseCells(array $cells, $namedIndex = true)
 {
     $returnData = array();
     foreach ($cells as $cellName => $cellValue) {
         if (is_array($cellValue)) {
             $merges = array();
             foreach ($cellValue as $childField) {
                 $merges = array_merge($merges, $this->parseCells($childField, false));
             }
             $returnData = $this->mergeNestedCells($returnData, $merges);
             continue;
         }
         // The TableHeader holds 90% of the information, find it in order to resolve the rest
         $tableHeader = $this->getTableHeader($cellName, $cellValue);
         $tableCell = new TableCellModel($tableHeader->getName(), $this->extractRowValue($cells, $tableHeader->getSafeName()));
         $tableCell->setVisible($tableHeader->isVisible());
         $tableCell->setDataType($tableHeader->getDataType());
         $namedIndex ? $returnData[$tableHeader->getSafeName()] = $tableCell : ($returnData[] = $tableCell);
     }
     return $returnData;
 }
 /**
  * Wraps the content cell in a <td> element
  *
  * @param $dataStrategyResolver
  * @param TableCellModel $cell
  * @param string $tdClass
  * @return string
  */
 public static function printTableCell(StrategyResolver $dataStrategyResolver, TableCellModel $cell, $tdClass = "kolom")
 {
     return sprintf("<td class=\"%s\">", $tdClass . " " . $cell->getSafeName()) . $dataStrategyResolver->resolveAndParse($cell->getValue(), $cell->getName()) . '</td>';
 }