original_string: private function getCalculatedWidowsHeight(TcTable $table, $rows, callable $fn = null) {
          $count = count($rows);
          $limit = $count - $this->minWidowsOnPage;
          $h = 0;
          if ($this->minWidowsOnPage && $count && $limit >= 0) {
              for ($i = $count - 1; $i >= $limit; $i--) {
                  // the userfunc has returned false everytime, so in the end, the
                  // data array is empty. Return current height.
                  if (!isset($rows[$i])) {
                      return $h;
                  }
                  $data = $fn ? $fn($table, $rows[$i], $i, true) : $rows[$i];
                  // check row only if it's an array. It gives the possibility to
                  // skip some rows with the user func
                  if (is_array($data) || is_object($data)) {
                      $this->_widowsCalculatedHeight[$i] = $table->getCurrentRowHeight($data);
                      $h += $this->_widowsCalculatedHeight[$i];
                  } else {
                      // adapt limit so the widow management behave the best it
                      // can
                      $limit--;
                  }
              }
          }
          return $h;
      }
code: private function getCalculatedWidowsHeight(TcTable $table, $rows, callable $fn = null) {
          $count = count($rows);
          $limit = $count - $this->minWidowsOnPage;
          $h = 0;
          if ($this->minWidowsOnPage && $count && $limit >= 0) {
              for ($i = $count - 1; $i >= $limit; $i--) {
                  // the userfunc has returned false everytime, so in the end, the
                  // data array is empty. Return current height.
                  if (!isset($rows[$i])) {
                      return $h;
                  }
                  $data = $fn ? $fn($table, $rows[$i], $i, true) : $rows[$i];
                  // check row only if it's an array. It gives the possibility to
                  // skip some rows with the user func
                  if (is_array($data) || is_object($data)) {
                      $this->_widowsCalculatedHeight[$i] = $table->getCurrentRowHeight($data);
                      $h += $this->_widowsCalculatedHeight[$i];
                  } else {
                      // adapt limit so the widow management behave the best it
                      // can
                      $limit--;
                  }
              }
          }
          return $h;
      }
code_tokens: private function getCalculatedWidowsHeight ( TcTable $ table , $ rows , callable $ fn = null ) { $ count = count ( $ rows ) ; $ limit = $ count - $ this -> minWidowsOnPage ; $ h = 0 ; if ( $ this -> minWidowsOnPage && $ count && $ limit >= 0 ) { for ( $ i = $ count - 1 ; $ i >= $ limit ; $ i -- ) { // the userfunc has returned false everytime, so in the end, the // data array is empty. Return current height. if ( ! isset ( $ rows [ $ i ] ) ) { return $ h ; } $ data = $ fn ? $ fn ( $ table , $ rows [ $ i ] , $ i , true ) : $ rows [ $ i ] ; // check row only if it's an array. It gives the possibility to // skip some rows with the user func if ( is_array ( $ data ) || is_object ( $ data ) ) { $ this -> _widowsCalculatedHeight [ $ i ] = $ table -> getCurrentRowHeight ( $ data ) ; $ h += $ this -> _widowsCalculatedHeight [ $ i ] ; } else { // adapt limit so the widow management behave the best it // can $ limit -- ; } } } return $ h ; }
docstring: Get real height that widows will take. Used to force a page break if the
  remaining height isn't enough to draw all the widows on the current page.
  
  @param TcTable $table
  @param array|Traversable $rows the complete set of data
  @param callable $fn addBody function for data layout
  @return float
docstring_tokens: Get real height that widows will take . Used to force a page break if the remaining height isn t enough to draw all the widows on the current page .