Ejemplo n.º 1
0
 /**
  * Retrieves the header of the table.
  *
  * @param TableNode $table The table node.
  * @return Array The names of the header cells.
  */
 private function getHeader($table)
 {
     $rows = $table->getChildren();
     if (empty($rows)) {
         return array();
     }
     if (count($rows[0]->getChildren()) > 1) {
         $headerRow = $rows[0];
     } else {
         if (count($rows) > 1 && count($rows[1]->getChildren()) > 1) {
             $headerRow = $rows[1];
         } else {
             return array();
         }
     }
     $header = array();
     foreach ($headerRow->getChildren() as $headerCell) {
         $headerStr = $this->nodeToString($headerCell);
         if (empty($headerStr)) {
             continue;
         }
         $header[] = $headerStr;
     }
     return $header;
 }