Code Duplication    Length = 10-15 lines in 2 locations

source/FluidXml.php 2 locations

@@ 955-964 (lines=10) @@
952
                return [];
953
        }
954
955
        protected function insertStringString($parent, $k, $v, $fn)
956
        {
957
                // The user has passed an element name and an element value:
958
                // [ 'element' => 'Element content' ]
959
960
                $el = $this->createElement($k, $v);
961
                $el = $fn($parent, $el);
962
963
                return [ $el ];
964
        }
965
966
        protected function insertStringMixed($parent, $k, $v, $fn, &$optionals)
967
        {
@@ 966-980 (lines=15) @@
963
                return [ $el ];
964
        }
965
966
        protected function insertStringMixed($parent, $k, $v, $fn, &$optionals)
967
        {
968
                // The user has passed one of these two cases:
969
                // - [ 'element' => [...] ]
970
                // - [ 'element' => DOMNode|SimpleXMLElement|FluidXml ]
971
972
                $el = $this->createElement($k);
973
                $el = $fn($parent, $el);
974
975
                // The new children elements must be created in the order
976
                // they are supplied, so 'appendChild' is the perfect operation.
977
                $this->newContext($el)->appendChild($v, ...$optionals);
978
979
                return [ $el ];
980
        }
981
982
        protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals)
983
        {