public static function toString($diff, $separator = "\n")
    {
        // initialise the string
        $string = '';

        // loop over the lines in the diff
        foreach ($diff as $line) {
            // extend the string with the line
            switch ($line[1]) {
                case self::UNMODIFIED:
                    $string .= '  ' . $line[0];
                    break;
                case self::DELETED:
                    $string .= '- ' . $line[0];
                    break;
                case self::INSERTED:
                    $string .= '+ ' . $line[0];
                    break;
                default:
                    throw new Exception('Undefined type ('.$line[1].').');
            }

            // extend the string with the separator
            $string .= $separator;
        }

        return $string;
    }