original_string: private function addRow($row, $index = null) {
          $this->copyDefaultColumnDefinitions($row, $index);
          if ($this->trigger(self::EV_ROW_ADD, [$row, $index]) === false) {
              return $this;
          }
          $h = $this->getRowHeight();
          $page_break_trigger = $this->pdf->getPageHeight() - $this->pdf->getBreakMargin();
          if ($this->pdf->GetY() + $h >= $page_break_trigger) {
              if ($this->trigger(self::EV_PAGE_ADD, [$row, $index, false]) !== false) {
                  $this->pdf->AddPage();
                  $this->trigger(self::EV_PAGE_ADDED, [$row, $index, false]);
              }
          }
          foreach ($this->columnDefinition as $key => $value) {
              if (isset($this->rowDefinition[$key])) {
                  $this->addCell($key, isset($row[$key]) ? $row[$key] : '', $row);
              }
          }
          $this->trigger(self::EV_ROW_ADDED, [$row, $index]);
          return $this;
      }
code: private function addRow($row, $index = null) {
          $this->copyDefaultColumnDefinitions($row, $index);
          if ($this->trigger(self::EV_ROW_ADD, [$row, $index]) === false) {
              return $this;
          }
          $h = $this->getRowHeight();
          $page_break_trigger = $this->pdf->getPageHeight() - $this->pdf->getBreakMargin();
          if ($this->pdf->GetY() + $h >= $page_break_trigger) {
              if ($this->trigger(self::EV_PAGE_ADD, [$row, $index, false]) !== false) {
                  $this->pdf->AddPage();
                  $this->trigger(self::EV_PAGE_ADDED, [$row, $index, false]);
              }
          }
          foreach ($this->columnDefinition as $key => $value) {
              if (isset($this->rowDefinition[$key])) {
                  $this->addCell($key, isset($row[$key]) ? $row[$key] : '', $row);
              }
          }
          $this->trigger(self::EV_ROW_ADDED, [$row, $index]);
          return $this;
      }
code_tokens: private function addRow ( $ row , $ index = null ) { $ this -> copyDefaultColumnDefinitions ( $ row , $ index ) ; if ( $ this -> trigger ( self :: EV_ROW_ADD , [ $ row , $ index ] ) === false ) { return $ this ; } $ h = $ this -> getRowHeight ( ) ; $ page_break_trigger = $ this -> pdf -> getPageHeight ( ) - $ this -> pdf -> getBreakMargin ( ) ; if ( $ this -> pdf -> GetY ( ) + $ h >= $ page_break_trigger ) { if ( $ this -> trigger ( self :: EV_PAGE_ADD , [ $ row , $ index , false ] ) !== false ) { $ this -> pdf -> AddPage ( ) ; $ this -> trigger ( self :: EV_PAGE_ADDED , [ $ row , $ index , false ] ) ; } } foreach ( $ this -> columnDefinition as $ key => $ value ) { if ( isset ( $ this -> rowDefinition [ $ key ] ) ) { $ this -> addCell ( $ key , isset ( $ row [ $ key ] ) ? $ row [ $ key ] : '' , $ row ) ; } } $ this -> trigger ( self :: EV_ROW_ADDED , [ $ row , $ index ] ) ; return $ this ; }
docstring: Add a row
  
  @param array|object $row row data
  @param int $index row index
  @return TcTable
docstring_tokens: Add a row