3 * Portions taken from phpwiki-1.3.3.
5 * Copyright © 2000, 2001 Geoffrey T. Dairiki <dairiki@dairiki.org>
6 * You may copy this code freely under the conditions of the GPL.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
24 * @ingroup DifferenceEngine
28 * A formatter that outputs unified diffs
29 * @ingroup DifferenceEngine
31 class UnifiedDiffFormatter
extends DiffFormatter
{
34 protected $leadingContextLines = 2;
37 protected $trailingContextLines = 2;
40 * @param string[] $lines
42 protected function added( $lines ) {
43 $this->lines( $lines, '+' );
47 * @param string[] $lines
49 protected function deleted( $lines ) {
50 $this->lines( $lines, '-' );
54 * @param string[] $orig
55 * @param string[] $closing
57 protected function changed( $orig, $closing ) {
58 $this->deleted( $orig );
59 $this->added( $closing );
70 protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) {
71 return "@@ -$xbeg,$xlen +$ybeg,$ylen @@";