@@ -7,39 +7,41 @@ If you only use the `DiffHelper` and built-in `Renderer`s,
7
7
there is no breaking change for you so you do not have to do anything.
8
8
9
9
10
- ### External Breaking Changes
10
+ ### Breaking Changes for Normal Users
11
11
12
- - The ` Diff ` class has been renamed to ` Differ ` .
13
- It's easy to adapt to this by changing the class name.
12
+ - The ` Diff ` class has been renamed as ` Differ ` .
13
+ It should be relatively easy to adapt to this by changing the class name.
14
14
15
- - The term ` template ` has been renamed to ` renderer ` . Some examples are:
15
+ - The term ` template ` has been renamed as ` renderer ` . Some examples are:
16
16
17
17
- Method ` DiffHelper::getRenderersInfo() `
18
18
- Method ` DiffHelper::getAvailableRenderers() `
19
19
- Constant ` RendererConstant::RENDERER_TYPES `
20
20
- Constant ` AbstractRenderer::IS_TEXT_RENDERER `
21
21
22
22
- Now a ` Renderer ` has a ` render() ` method, but a ` Differ ` does not.
23
+ (because it makes more sense saying a renderer would render something)
23
24
If you use those classes by yourself, it should be written like below.
24
25
25
26
``` php
26
27
use Jfcherng\Diff\Differ;
27
28
use Jfcherng\Diff\Factory\RendererFactory;
28
29
29
30
$differ = new Differ(explode("\n", $old), explode("\n", $new), $diffOptions);
30
- $renderer = RendererFactory::make($renderer , $rendererOptions);
31
- $result = $renderer->render($differ); // <-- this has been changed
31
+ $renderer = RendererFactory::make($rendererName , $rendererOptions);
32
+ $result = $renderer->render($differ); // <-- this line has been changed
32
33
```
33
34
34
- - Add `RendererInterface::getResultForIdenticals()`.
35
- `AbstractRenderer::getResultForIdenticals()` returns an empty string by default.
36
35
37
- - Remove the deprecated `AbstractRenderer::getIdenticalResult()`.
38
- Use /implement the `AbstractRenderer::getResultForIdenticals()` instead.
36
+ ### Breaking Changes for Customized Renderer Developers
39
37
40
-
41
- ### Internal Breaking Changes
38
+ - Remove the deprecated `AbstractRenderer::getIdenticalResult()` and
39
+ add `RendererInterface::getResultForIdenticals()`. The returned value will be
40
+ directly used before actually starting to calculate diff if we find that the
41
+ two strings are the same. `AbstractRenderer::getResultForIdenticals()`
42
+ returns an empty string by default.
42
43
43
44
- Now a `Renderer` should implement `protected function renderWoker(Differ $differ): string`
44
- rather than the previous `public function render(): string`. Note that `$this- >diff` no longer
45
- works in `Renderer`s as it is now injected as the parameter to `Renderer::renderWoker()`.
45
+ rather than the previous `public function render(): string`. Note that
46
+ `$this- >diff` no longer works in `Renderer`s as it is now injected as a
47
+ parameter to `Renderer::renderWoker()`.
0 commit comments