@@ -760,39 +760,6 @@ public static function createTextNode(string $nodeText, bool $escHtmlEntities =
760760
761761 return $ text ;
762762 }
763- /**
764- * Removes bare line feed characters (LF) and replaces them with CRLF.
765- *
766- * A bare line feed is LF which was not preceded by a carriage return (CR).
767- *
768- * @param string $str The string to be fixed.
769- *
770- * @return string The method will return a string with all bare line feed
771- * characters replaced with CRLF.
772- */
773- public static function fixBareLineFeed (string $ str ) : string {
774- $ finalStr = '' ;
775- $ index = 0 ;
776- $ len = strlen ($ str );
777-
778- for ($ index = 0 ; $ index < $ len ; $ index ++) {
779- $ char = $ str [$ index ];
780-
781- if ($ char == "\n" ) {
782-
783- if ($ index != 0 && $ str [$ index - 1 ] != "\r" ) {
784- //Bare line feed found. Replace with \r\n
785- $ finalStr = trim ($ finalStr ).HTMLDoc::NL ;
786- } else {
787- $ finalStr .= $ char ;
788- }
789- } else {
790- $ finalStr .= $ char ;
791- }
792- }
793-
794- return $ finalStr ;
795- }
796763
797764 #[ReturnTypeWillChange]
798765 /**
@@ -823,6 +790,38 @@ public function current() {
823790 public function div (array $ attributes = []) : HTMLNode {
824791 return $ this ->addChild (new HTMLNode (), $ attributes );
825792 }
793+ /**
794+ * Removes bare line feed characters (LF) and replaces them with CRLF.
795+ *
796+ * A bare line feed is LF which was not preceded by a carriage return (CR).
797+ *
798+ * @param string $str The string to be fixed.
799+ *
800+ * @return string The method will return a string with all bare line feed
801+ * characters replaced with CRLF.
802+ */
803+ public static function fixBareLineFeed (string $ str ) : string {
804+ $ finalStr = '' ;
805+ $ index = 0 ;
806+ $ len = strlen ($ str );
807+
808+ for ($ index = 0 ; $ index < $ len ; $ index ++) {
809+ $ char = $ str [$ index ];
810+
811+ if ($ char == "\n" ) {
812+ if ($ index != 0 && $ str [$ index - 1 ] != "\r" ) {
813+ //Bare line feed found. Replace with \r\n
814+ $ finalStr = trim ($ finalStr ).HTMLDoc::NL ;
815+ } else {
816+ $ finalStr .= $ char ;
817+ }
818+ } else {
819+ $ finalStr .= $ char ;
820+ }
821+ }
822+
823+ return $ finalStr ;
824+ }
826825 /**
827826 * Adds a <form> element to the body of the node.
828827 *
0 commit comments