1 | <?php |
||
19 | class ConsoleDiff extends FirstDiff |
||
20 | { |
||
21 | const REPLACEMENT_CHAR = "\6"; |
||
22 | |||
23 | /** @var CursorInterface */ |
||
24 | private $cursor; |
||
25 | |||
26 | /** |
||
27 | * ConsoleDiff constructor. |
||
28 | * |
||
29 | * @param CursorInterface|null $cursor The cursor used to move around the screen |
||
30 | */ |
||
31 | public function __construct(CursorInterface $cursor = null) |
||
35 | |||
36 | /** |
||
37 | * Loop through each line, and produce a difference report of what to write out to the terminal |
||
38 | * |
||
39 | * Assumes the beginning of old and new are the same line |
||
40 | * |
||
41 | * @param string[] $old |
||
42 | * @param string[] $new |
||
43 | * |
||
44 | * @return array [[:col, :str]] |
||
45 | */ |
||
46 | public function lines(array $old, array $new) |
||
63 | |||
64 | /** |
||
65 | * Looks through a line to find the character to of the first difference between the 2 strings. |
||
66 | * |
||
67 | * If no difference is found, returns -1 |
||
68 | * |
||
69 | * @param string $old |
||
70 | * @param string $new |
||
71 | * |
||
72 | * @return int |
||
73 | */ |
||
74 | public function firstDifference($old, $new) |
||
107 | } |
||
108 |