Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return associative php array in DiffHelper::calculate #90

Open
maxiirs opened this issue Dec 2, 2024 · 1 comment
Open

Return associative php array in DiffHelper::calculate #90

maxiirs opened this issue Dec 2, 2024 · 1 comment

Comments

@maxiirs
Copy link

maxiirs commented Dec 2, 2024

Currently, one has to use json_decode() to access diff properties. This approach is cumbersome and adds unnecessary complexity to the code. It would be helpful to have an option to directly retrieve the diffs as an associative array, simplifying access and improving processing efficiency.

@jfcherng
Copy link
Owner

jfcherng commented Dec 2, 2024

Currently, one has to use json_decode() to access diff properties.

Because it's not a design goal. If you want that rather than rendered diff, you probably just use https://github.com/jfcherng/php-sequence-matcher . This lib is based on that too.


I don't have an idea how it could be done beautifully, since a renderer is required to return a string by design.

You may use the getChanges() method of any HTML renderer to get the diff in php array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants