public function getCode(): string
  {
    $lines       = [];
    $indentLevel = 0;

    foreach ($this->lines as $line)
    {
      $mode = $this->indentationMode($line);

      // Increment or decrement indentation level.
      if ($mode & self::C_INDENT_INCREMENT_BEFORE)
      {
        $indentLevel++;
      }
      if ($mode & self::C_INDENT_DECREMENT_BEFORE)
      {
        $indentLevel = max(0, $indentLevel - 1);
      }
      if ($mode & self::C_INDENT_DECREMENT_BEFORE_DOUBLE)
      {
        $indentLevel = max(0, $indentLevel - 2);
      }

      // If the line is a separator shorten the separator.
      if ($this->separator!==null && $line==$this->separator)
      {
        $line = $this->shortenSeparator($this->width - $this->indentation * $indentLevel);
      }

      // Append the line with indentation.
      $lines[] = $this->addIndentation($line, $indentLevel);

      // Increment or decrement indentation level.
      if ($mode & self::C_INDENT_INCREMENT_AFTER)
      {
        $indentLevel++;
      }
      if ($mode & self::C_INDENT_DECREMENT_AFTER)
      {
        $indentLevel = max(0, $indentLevel - 1);
      }
    }

    if (empty($lines))
    {
      return '';
    }

    return implode(PHP_EOL, $lines).PHP_EOL;
  }