feat: native SVG Form XObject support with transform coverage#23
Merged
Conversation
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add testEmbedCorrectlyDetectsSvgByFileExtensionBoundary with data provider - Test cases for .svg/.svgz, case-insensitive detection, boundary conditions - Validates regex anchor ($) is essential - without it, .svg.txt etc. would match - Optimize count() evaluation in loops (store in variable before loop) - Simplify test assertions to avoid risky test warnings This test coverage kills the escaped mutant that removes regex anchors in isSvgSource detection. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Simplify test to use mock factory returns instead of exceptions - Ensure both SVG and non-SVG branches execute and assert properly - Remove unnecessary complexity that caused test failures - All 421 tests pass with 5216 assertions Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Create PathParsingState to encapsulate command parsing state - Create PathCommandContext to encapsulate transform/coordinate context - Refactor convertPathData() to use state/context objects - Extract handler methods for each SVG path command (M,L,H,V,C,S,Q,T,A,Z) - Reduce parameter counts from 10 to 2 by using context objects - Remove ExcessiveParameterList PHPMD violation - All 421 tests passing Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Extract normalizeArcRadii() to handle radii validation/scaling - Extract calculateArcCenter() for center point computation - Extract calculateArcAngles() for angle calculations - Extract generateArcCurves() for cubic Bézier segment generation - Reduce arcToBezierCurves() from 117 to 40 lines - Remove ExcessiveMethodLength and NPath violations on arcToBezierCurves - All 421 tests passing Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Extract shared resolveColorAttribute() method for color resolution - Eliminate duplication between resolveFillColor/resolveStrokeColor - Reduce NPath violations from 960+384=1344 to single 960 - Complexity reduced from 213 to 206 overall - All 421 tests passing Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Move arcToBezierCurves and 4 helper methods to separate class - Reduce SvgPdfXObjectFactory from 1509 to 1255 lines (-254) - Reduce method count from 48 to 43 (-5) - Reduce class complexity from 206 to 186 (-20) - All 421 tests passing - Pure math/utility methods with no state dependencies Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Move resolveFillColor, resolveStrokeColor, resolveColorAttribute to SvgColorResolver - Move extractColorFromStyleAttribute, extractValueFromStyleAttribute, normalizeColor - Inject SvgColorResolver as dependency via constructor - Reduce factory from 1255 to 1122 lines (-133) - Reduce method count from 43 to 37 (-6) - Reduce class complexity from 186 to 159 (-27) - All 421 tests passing Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…hCommandParser; reduce CC - Extract SvgTransformResolver to encapsulate SVG transform matrix resolution - Extract SvgPathCommandParser to handle SVG path data parsing (CC reduced from 74 to ~48) - Add resolveCoord() helper to eliminate 26 relative-coord ternaries - Add reflectControlPoint() helper for smooth cubic/quadratic S/T commands - Extract SvgElementPathBuilder to build PDF path strings from SVG shape elements - Update SvgPdfXObjectFactory to delegate to extracted classes (ExcessiveClassComplexity fixed) - Fix SvgColorResolver.resolveColorAttribute() CC: 10 -> 9 via PREG_SPLIT_NO_EMPTY - Add @SuppressWarnings(PHPMD.ExcessiveParameterList) to ArcParams (domain-mandated 10-param DTO) All PHPMD violations resolved; 421 unit tests passing. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…pliance Infection's class reflection requires each class to reside in a file matching its name. ArcParams was co-located with SvgArcConverter, causing Infection to fail with 'Class does not exist' during mutation generation. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…ance PathCommandContext was co-located with PathParsingState; Infection requires each class in a file matching its name. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Rename short variable names (, , etc.) to descriptive names (, , etc.) to comply with PHPMD minimum 3-character rule - Update variable names in ArcParams.php, SvgArcConverter.php, SvgElementPathBuilder.php, SvgPathCommandParser.php, and SvgTransformResolver.php - Refactor SvgPathCommandParser to extract tokenization logic (tokenizePathData) and token processing (processPathTokens) to reduce method complexity - Add @SuppressWarnings annotation for ExcessiveClassComplexity in SvgPathCommandParser to account for legitimate SVG command handling All PHPMD checks now pass without violations. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
b938adb to
50df875
Compare
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SvgPdfXObjectFactorytests/Fixtures/Pdf/SvgWhat was validated
scripts/quality-gate.sh) passingNotes addressing review concerns
tests/Fixtures/Pdf/Svg/govbr-logo.svg) and asserts Form XObject usage.govbr-logo.pngwas removed from the pending change set.src/Pdf/Svgstructure conventions.Commit strategy
Commits were created one file per commit, all with DCO sign-off (
-s).