1 | <?php |
||||
2 | |||||
3 | namespace Bavix\Diff; |
||||
4 | |||||
5 | use Bavix\Exceptions\Runtime; |
||||
6 | |||||
7 | class Native implements Driver |
||||
8 | { |
||||
9 | |||||
10 | /** |
||||
11 | * Native constructor. |
||||
12 | * |
||||
13 | * @throws Runtime |
||||
14 | */ |
||||
15 | public function __construct() |
||||
16 | { |
||||
17 | if (!function_exists('xdiff_string_diff')) |
||||
18 | { |
||||
19 | throw new Runtime('Extension `xdiff` not found'); |
||||
20 | } |
||||
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 \xdiff_string_diff($oldData, $newData); |
||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
32 | } |
||||
33 | |||||
34 | /** |
||||
35 | * @param string $data |
||||
36 | * @param string $patch |
||||
37 | * |
||||
38 | * @return string |
||||
39 | */ |
||||
40 | public function patch($data, $patch) |
||||
41 | { |
||||
42 | return \xdiff_string_patch($data, $patch); |
||||
0 ignored issues
–
show
The function
xdiff_string_patch was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
43 | } |
||||
44 | |||||
45 | } |
||||
46 |