| Total Complexity | 3 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Differ implements Driver |
||
| 8 | { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @var DiffMatchPatch |
||
| 12 | */ |
||
| 13 | protected $dmp; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Diff constructor. |
||
| 17 | */ |
||
| 18 | public function __construct() |
||
| 19 | { |
||
| 20 | $this->dmp = new DiffMatchPatch(); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param string $oldData |
||
| 25 | * @param string $newData |
||
| 26 | * |
||
| 27 | * @return string |
||
| 28 | */ |
||
| 29 | public function diff($oldData, $newData) |
||
| 30 | { |
||
| 31 | return $this->dmp->patch_toText( |
||
| 32 | $this->dmp->patch_make($oldData, $newData) |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $data |
||
| 38 | * @param string $patch |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public function patch($data, $patch) |
||
| 48 | } |
||
| 49 | |||
| 50 | } |
||
| 51 |