Code Duplication    Length = 10-15 lines in 2 locations

source/FluidXml.php 2 locations

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