private function writeLines($output, $nbRows, $height, $lines)
{
$limit = count($lines);
// if the output will exceed the height of the terminal
if ($nbRows + $limit > $height) {
// set the limit to the different and subtract one (for the prompt)
$limit = $height - $nbRows;
}
for ($i = 0; $i < $limit; $i++) {
$line = $lines[$i];
$output->writeln($line);
$nbRows++;
}
return $nbRows;
}