File: Differ.php

package info (click to toggle)
wikidiff2 1.2%2Bgit03ea59f-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 276 kB
  • ctags: 240
  • sloc: cpp: 1,357; php: 172; makefile: 13
file content (34 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

interface Differ {
	function diff( $a, $b );
}

class TableDiffer implements Differ {
	public function diff( $a, $b ) {
		return '<table>'
			. wikidiff2_do_diff( $a, $b, 2 )
			. '</table>';
	}
}

class InlineDiffer implements Differ {
	public function diff( $a, $b ) {
		return wikidiff2_inline_diff( $a, $b, 2 );
	}
}

class BothDiffer implements Differ {
	private $table, $inline;

	public function __construct() {
		$this->table = new TableDiffer;
		$this->inline = new InlineDiffer;
	}

	public function diff( $a, $b ) {
		return $this->table->diff( $a, $b )
			. $this->inline->diff( $a, $b );
	}
}