public static function toTable($diff, $indentation = '', $separator = '<br />')
    {
        // initialise the HTML
        $html = $indentation . "<table class=\"diff\">\n";

        // loop over the lines in the diff
        $index = 0;
        while ($index < count($diff)) {
            // determine the line type
            switch ($diff[$index][1]) {
                // display the content on the left and right
                case self::UNMODIFIED:
                    $leftCell =
                        self::getCellContent(
                            $diff,
                            $indentation,
                            $separator,
                            $index,
                            self::UNMODIFIED
                        );
                    $rightCell = $leftCell;
                    break;

                // display the deleted on the left and inserted content on the right
                case self::DELETED:
                    $leftCell =
                        self::getCellContent(
                            $diff,
                            $indentation,
                            $separator,
                            $index,
                            self::DELETED
                        );
                    $rightCell =
                        self::getCellContent(
                            $diff,
                            $indentation,
                            $separator,
                            $index,
                            self::INSERTED
                        );
                    break;

                // display the inserted content on the right
                case self::INSERTED:
                    $leftCell = '';
                    $rightCell =
                        self::getCellContent(
                            $diff,
                            $indentation,
                            $separator,
                            $index,
                            self::INSERTED
                        );
                    break;

                default:
                    throw new Exception('Undefined type ('.$diff[$index][1].').');
            }

            // extend the HTML with the new row
            $html .=
                $indentation
                . "  <tr>\n"
                . $indentation
                . '    <td class="diff'
                . ($leftCell == $rightCell
                    ? 'Unmodified'
                    : ($leftCell == '' ? 'Blank' : 'Deleted'))
                . '">'
                . $leftCell
                . "</td>\n"
                . $indentation
                . '    <td class="diff'
                . ($leftCell == $rightCell
                    ? 'Unmodified'
                    : ($rightCell == '' ? 'Blank' : 'Inserted'))
                . '">'
                . $rightCell
                . "</td>\n"
                . $indentation
                . "  </tr>\n";
        }

        return $html . $indentation . "</table>\n";
    }