Skip to content

Generators/[HTML|Markdown|Text]::getFormattedCodeComparisonBlock(): minor refactor #836

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

Merged
merged 5 commits into from
Mar 3, 2025

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Feb 19, 2025

Description

These five commits basically apply the same changes to all three Generator classes (reduce code duplication), which is why I've combined them in one PR.


Generators/HTML::getFormattedCodeComparisonBlock(): minor refactor

Move some duplicate code to dedicated private methods.

Generators/Markdown::getFormattedCodeComparisonBlock(): minor refactor

Move some duplicate code to dedicated private methods.

Generators/Text::getFormattedCodeComparisonBlock(): minor refactor [1]

Move some duplicate code to dedicated private methods.

Generators/Text::codeTitleToLines(): simplify the logic

There's absolutely no need for custom word-wrapping logic when PHP contains a function which can do this perfectly well.

Generators/Text::getFormattedCodeComparisonBlock(): minor refactor [2]

Move yet more duplicate code to a dedicated private method.

Suggested changelog entry

N/A

Related issues/external references

This PR is part of a series of PRs which will add a complete set of tests (and improvements) for the Generator feature.

Also see: #671 and other PRs with the Core Component: Generators label.

Move some duplicate code to dedicated `private` methods.
Move some duplicate code to dedicated `private` methods.
Move some duplicate code to dedicated `private` methods.
There's absolutely no need for custom word-wrapping logic when PHP contains a function which can do this perfectly well.
Move yet more duplicate code to a dedicated `private` method.
@jrfnl jrfnl added this to the 3.12.0 milestone Feb 19, 2025
@jrfnl jrfnl merged commit 9c6ad66 into master Mar 3, 2025
59 checks passed
@jrfnl jrfnl deleted the feature/generators-refactor-logic branch March 3, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant