WikiLambda
MediaWiki WikiLambda extension
|
Public Member Functions | |
setZObjectDiffer (ZObjectDiffer $zObjectDiffer) | |
Setter for the differ service that will calculate the diffs for every idem of the list. | |
doDiff (array $oldArray, array $newArray) | |
MediaWiki\Extension\WikiLambda\Diff\ZObjectListDiffer::doDiff | ( | array | $oldArray, |
array | $newArray ) |
Compares the difference between two Typed Lists
array | $oldArray | The first array |
array | $newArray | The second array |
Exception |
FIXME: According to T312259 the items in a list can be reordered.
Current implementation will find diffs between the items on the same position when the two lists have identical length.
If we want to find position changes and flag them as such, we should calculate the edit matrix also when the count of elements is the same in $newArray and $oldArray.
This would give us some matrix edit count like the following:
| 0 1 1 | | 1 1 0 | | 1 0 1 |
Where the zero edits are not in the matrix diagonal. This would probably flag a couple of indexChange edits such as:
[ list.1, indexChange, [1, 2] ] [ list.2, indexChange, [2, 1] ]
However, this means that for equal length arrays the complexity of finding a diff would directly go from O(n) to O(n2).
MediaWiki\Extension\WikiLambda\Diff\ZObjectListDiffer::setZObjectDiffer | ( | ZObjectDiffer | $zObjectDiffer | ) |
Setter for the differ service that will calculate the diffs for every idem of the list.
ZObjectDiffer | $zObjectDiffer |