Skip to content

Commit 532bd4a

Browse files
authored
Merge pull request #79 from JBlond/maintenance
maintenance
2 parents c64c0cc + 013f862 commit 532bd4a

25 files changed

+353
-354
lines changed

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
## Introduction
88

9-
A comprehensive library for generating differences between two hashable objects (strings or arrays).
10-
Generated differences can be rendered in all the standard formats including:
9+
A comprehensive library for generating differences between two hashable
10+
objects (strings or arrays). Generated differences can be rendered in all the
11+
standard formats including:
1112

1213
* Unified
1314
* Context
@@ -16,8 +17,9 @@ Generated differences can be rendered in all the standard formats including:
1617
* Unified HTML
1718
* Unified Commandline colored output
1819

19-
The logic behind the core of the diff engine (ie, the sequence matcher) is primarily based on the Python difflib
20-
package. The reason for doing so is primarily because of its high degree of accuracy.
20+
The logic behind the core of the diff engine (ie, the sequence matcher) is
21+
primarily based on the Python difflib package. The reason for doing so is
22+
primarily because of its high degree of accuracy.
2123

2224
## Install
2325

@@ -31,7 +33,7 @@ For cli usage you need to install the suggested `jblond/php-cli` package.
3133

3234
## Documentation
3335

34-
See the [Wiki](https://github.com/JBlond/php-diff/wiki) for
36+
See the [Wiki](https://github.com/JBlond/php-diff/wiki) for
3537

3638
* [Getting started](https://github.com/JBlond/php-diff/wiki/1.-Getting-Started)
3739
* [Parameters and Options](https://github.com/JBlond/php-diff/wiki/2.-Parameters-and-Options)
@@ -82,8 +84,9 @@ echo $diff->isIdentical() ? 'No differences found.' : '<pre>' . htmlspecialchars
8284
```
8385

8486
### Example Output
85-
File `example.php` contains a quick demo and can be found in the `example/` directory.
86-
Included is a light and a dark theme.
87+
88+
File `example.php` contains a quick demo and can be found in the `example/`
89+
directory. Included is a light and a dark theme.
8790

8891
#### HTML Side By Side Example
8992

@@ -115,7 +118,6 @@ Included is a light and a dark theme.
115118

116119
<details><summary>HTML Side By Side Dark Theme Example</summary><br>
117120

118-
119121
![HTML Side By Side Dark Theme Example](assets/htmlSidebySideDarkTheme.png "HTML Side By Side Dark Theme Example")
120122

121123
</details>
@@ -128,16 +130,18 @@ Included is a light and a dark theme.
128130

129131
## Contribution, Issues and feature requests
130132

131-
If you found a bug, or have an idea for new functionality,
132-
feel free to report it on the issue tracker - just use search beforehand.
133+
If you found a bug, or have an idea for new functionality, feel free to report
134+
it on the issue tracker - just use search beforehand.
133135
[Issue tracker](https://github.com/JBlond/php-diff/issues)
134136

135137
You can also fork this repository and open a PR.
136138

137139
## Merge files using jQuery
138140

139-
Xiphe has build a jQuery plugin with that you can merge the compared files.
140-
Have a look at [jQuery-Merge-for-php-diff](https://github.com/Xiphe/jQuery-Merge-for-php-diff).
141+
Xiphe has build a jQuery plugin with that you can merge the compared files. Have
142+
a look
143+
at [jQuery-Merge-for-php-diff](https://github.com/Xiphe/jQuery-Merge-for-php-diff)
144+
.
141145

142146
## Todo
143147

changelog.md

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,120 +2,133 @@
22

33
## 2.3.0 (2020-11-19)
44

5-
- Add: Change log.
6-
- Fix: Html SideBySide renders equal lines of version 1 at both sides (Option ignoreCase).
7-
- Fix: Second parameter of string repeat function minimizes to 0.
8-
- Fix: #60 - Unified Cli renderer options incompatible with Main renderer options
9-
- Fix: #64 - Calculation of maxLineMarkerWidth independent of input format.
10-
- Add: Similarity calculation
11-
- Add: New marking levels for inline differences
12-
- Add: Html merged renderer
5+
* Add: Change log.
6+
7+
* Fix: Html SideBySide renders equal lines of version 1 at both sides (Option
8+
ignoreCase).
9+
10+
* Fix: Second parameter of string repeat function minimizes to 0.
11+
12+
* Fix: #60 - Unified Cli renderer options incompatible with Main renderer
13+
options
14+
15+
* Fix: #64 - Calculation of maxLineMarkerWidth independent of input format.
16+
17+
* Add: Similarity calculation
18+
19+
* Add: New marking levels for inline differences
20+
21+
* Add: Html merged renderer
1322

1423
## 2.2.1 (2020-08-06)
1524

16-
- Fix: #58 - Side by side diff shows empty diff
25+
* Fix: #58 - Side by side diff shows empty diff
1726

1827
## 2.2.0 (2020-07-23)
1928

20-
- Add: Option for a custom override renderer. #53
21-
- Add: No output when there are no differences between the compared strings / files. #52 #54
29+
* Add: Option for a custom override renderer. #53
30+
31+
* Add: No output when there are no differences between the compared strings /
32+
files. #52 #54
2233

2334
## 2.1.1 (2020-07-17)
2435

25-
- Fix: #50 - Renderers produce output with equal texts, while they shouldn't.
36+
* Fix: #50 - Renderers produce output with equal texts, while they shouldn't.
2637

2738
## 2.1.0 (2020-07-13)
2839

29-
- Add: Cli uncolored output. This allows it to be piped.
40+
* Add: Cli uncolored output. This allows it to be piped.
3041

3142
## 2.0.0 (2020-07-09)
3243

33-
- Add: Unified Commandline colored output.
34-
- Change: switch to semantic versioning.
44+
* Add: Unified Commandline colored output.
45+
* Change: switch to semantic versioning.
3546

3647
## 1.18 (2020-07-01)
3748

38-
- Add: A dark theme to the example.
39-
- Fix: Avoid variables with short names (some).
49+
* Add: A dark theme to the example.
50+
* Fix: Avoid variables with short names (some).
4051

4152
## 1.17 (2020-06-08)
4253

43-
- Fix #32 - Side by side diff shows only partially all deleted lines.
54+
* Fix #32 - Side by side diff shows only partially all deleted lines.
4455

4556
## 1.16 (2020-03-02)
4657

47-
- Features
48-
- Add: option trimEqual.
58+
* Features
59+
* Add: option trimEqual.
4960

50-
- Fixes
51-
- Fix PHPMD Violation.
52-
- Code Optimization, cleanup, refactoring and commenting.
61+
* Fixes
62+
* Fix PHPMD Violation.
63+
* Code Optimization, cleanup, refactoring and commenting.
5364

5465
## 1.15 (2020-01-24)
5566

56-
- Add: New Unified HTML.
57-
- Fix: Code clean up.
67+
* Add: New Unified HTML.
68+
* Fix: Code clean up.
5869

5970
## 1.14 (2019-12-03)
6071

61-
- Fix: Remove some old dead code.
72+
* Fix: Remove some old dead code.
6273

6374
## 1.13 (2019-10-08)
6475

65-
- Change: Switch to PSR12.
76+
* Change: Switch to PSR12.
6677

6778
## 1.12 (2019-03-18)
6879

69-
- Change: Update Composer Configuration.
70-
- Fix: PSR-2 conventions.
80+
* Change: Update Composer Configuration.
81+
* Fix: PSR-2 conventions.
7182

7283
## 1.11 (2019-02-22)
7384

74-
- Fix: Code clean up.
75-
- Fix: Composer autoloader for unit tests.
85+
* Fix: Code clean up.
86+
* Fix: Composer autoloader for unit tests.
7687

7788
## 1.10 (2019-02-20)
7889

79-
- Fix: Code clean up.
90+
* Fix: Code clean up.
8091

8192
## 1.9 (2019-02-19)
8293

83-
- Fix: Code clean up.
94+
* Fix: Code clean up.
8495

8596
## 1.8
8697

87-
- Change: Update Readme and bumping versions.
88-
- Fix: Moved include of Autoloader from the constructor to global space for HtmlArray unit test.
98+
* Change: Update Readme and bumping versions.
99+
100+
* Fix: Moved include of Autoloader from the constructor to global space for
101+
HtmlArray unit test.
89102

90103
## 1.7
91104

92-
- Fix: PSR-2 code alignment.
105+
* Fix: PSR-2 code alignment.
93106

94107
## 1.6
95108

96-
- Change: Bump required version of PHP to v7.1.
97-
- Add: Return type hinting.
109+
* Change: Bump required version of PHP to v7.1.
110+
* Add: Return type hinting.
98111

99112
## 1.5 (2019-01-15)
100113

101-
- Fix: Autoloader naming issues.
114+
* Fix: Autoloader naming issues.
102115

103116
## 1.4 (2019-01-14)
104117

105-
- Add: PSR-4 namespace support.
118+
* Add: PSR-4 namespace support.
106119

107120
## 1.3 (2019-01-11)
108121

109-
- Fix: PHP methods contained too much logic. That has been simplified.
122+
* Fix: PHP methods contained too much logic. That has been simplified.
110123

111124
## 1.2 (2018-01-23)
112125

113-
- Add: Support for custom titles.
126+
* Add: Support for custom titles.
114127

115128
## 1.1 (2017-05-06)
116129

117-
- Fix: Wrong highlight area for chinese characters.
130+
* Fix: Wrong highlight area for chinese characters.
118131

119-
## 1.0
132+
## 1.0
120133

121-
- Initial version.
134+
* Initial version.

example/dark-theme.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ a, a:visited {
5353
.Differences .Skipped {
5454
background: #F7F7F7;
5555
color: #000000;
56+
display: block;
5657
}
5758

5859
.Differences ins,

example/example.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ function changeCSS(cssFile, cssLinkIndex) {
7070
<hr>
7171
<aside>
7272
<h2>Informational</h2>
73-
Between the two versions, there's a <?php echo round($diff->getSimilarity(),2) * 100; ?>% match.
73+
Between the two versions, there's a
74+
<?php
75+
echo round($diff->getSimilarity(), 2) * 100;
76+
?>% match.
7477
</aside>
7578
<hr>
7679

example/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pre {
4747

4848
.Differences .Skipped {
4949
background: #F7F7F7;
50+
display: block;
5051
}
5152

5253
/*

lib/jblond/Diff/DiffUtils.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
*
88
* PHP version 7.2 or greater
99
*
10-
* @package jblond\Diff
11-
* @author Mario Brandt <leet31337@web.de>
12-
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
13-
* @version 2.3.0
14-
* @link https://github.com/JBlond/php-diff
10+
* @package jblond\Diff
11+
* @author Mario Brandt <leet31337@web.de>
12+
* @copyright (c) 2020 Mario Brandt
13+
* @license New BSD License http://www.opensource.org/licenses/bsd-license.php
14+
* @version 2.3.0
15+
* @link https://github.com/JBlond/php-diff
1516
*/
1617
class DiffUtils
1718
{
1819
/**
1920
* Sort an array by the nested arrays it contains. Helper function for getMatchingBlocks
2021
*
21-
* @param array $aArray First array to compare.
22-
* @param array $bArray Second array to compare.
22+
* @param array $aArray First array to compare.
23+
* @param array $bArray Second array to compare.
24+
*
2325
* @return int -1, 0 or 1, as expected by the usort function.
2426
*/
2527
public static function tupleSort(array $aArray, array $bArray): int
@@ -39,6 +41,7 @@ public static function tupleSort(array $aArray, array $bArray): int
3941
if (count($aArray) < count($bArray)) {
4042
return -1;
4143
}
44+
4245
return 1;
4346
}
4447
}

0 commit comments

Comments
 (0)