This PR refactors the convert method in Writer.php to improve modularity. The changes separate the responsibility of adding the format information from the convert method, making the code more modular and adhering to best practices. Additionally, the $format parameter is added back to the convert method to allow for flexibility in specifying the format.
Summary of Changes
Created a new file FormatInformation.php in the src directory to handle format information.
Modified the convert method in Writer.php to call the addFormatInformation method and concatenate the format information with the rest of the output.
Added the $format parameter back to the convert method with a default value of self::GEDCOM55.
Please review and merge these changes to improve the modularity of the convert method in Writer.php.
PR Feedback (click)
I created this PR to address this rule:
"Refactor large functions to be more modular."
Description
This PR refactors the
convert
method inWriter.php
to improve modularity. The changes separate the responsibility of adding the format information from theconvert
method, making the code more modular and adhering to best practices. Additionally, the$format
parameter is added back to theconvert
method to allow for flexibility in specifying the format.Summary of Changes
FormatInformation.php
in thesrc
directory to handle format information.convert
method inWriter.php
to call theaddFormatInformation
method and concatenate the format information with the rest of the output.$format
parameter back to theconvert
method with a default value ofself::GEDCOM55
.Please review and merge these changes to improve the modularity of the
convert
method inWriter.php
.