code: private function getSourceExcerpt($source='', $line=1, $plus=1, $format=false)
      {
          $excerpt = [];
          $twig  = Escape::html($source);
          $lines = preg_split("/(\r\n|\n|\r)/", $twig);
          $start = max(1, $line - $plus);
          $limit = min(count($lines), $line + $plus);
          for ($i = $start - 1; $i < $limit; $i++) {
              if ($format) {
                  $attr = 'data-line="'.($i+1).'"';
                  if ($i === $line - 1) $excerpt[] = "<mark $attr>$lines[$i]</mark>";
                  else $excerpt[] = "<span $attr>$lines[$i]</span>";
              }
              else {
                  $excerpt[] = $lines[$i];
              }
          }
          return implode("\n", $excerpt);
      }
docs: Extract a few lines of source code from a source string
  @param string $source
  @param int    $line
  @param int    $plus
  @param bool   $format
  @return string