1 | <?php |
||
19 | class ConsoleDiff extends FirstDiff |
||
20 | { |
||
21 | const REPLACEMENT_CHAR = "\6"; |
||
22 | |||
23 | /** @var CursorInterface */ |
||
24 | private $cursor; |
||
25 | /** @var string */ |
||
26 | private $regex; |
||
27 | |||
28 | /** |
||
29 | * ConsoleDiff constructor. |
||
30 | * |
||
31 | * @param CursorInterface|null $cursor The cursor used to move around the screen |
||
32 | */ |
||
33 | public function __construct(CursorInterface $cursor = null) |
||
41 | |||
42 | /** |
||
43 | * Loop through each line, and produce a difference report of what to write out to the terminal |
||
44 | * |
||
45 | * Assumes the beginning of old and new are the same line |
||
46 | * |
||
47 | * @param string[] $old |
||
48 | * @param string[] $new |
||
49 | * |
||
50 | * @return array [[:col, :str]] |
||
51 | */ |
||
52 | public function lines(array $old, array $new) |
||
69 | |||
70 | /** |
||
71 | * Looks through a line to find the character to of the first difference between the 2 strings. |
||
72 | * |
||
73 | * If no difference is found, returns -1 |
||
74 | * |
||
75 | * @param string $old |
||
76 | * @param string $new |
||
77 | * |
||
78 | * @return int |
||
79 | */ |
||
80 | public function firstDifference($old, $new) |
||
113 | } |
||
114 |