Code Duplication    Length = 10-15 lines in 2 locations

source/FluidXml.php 2 locations

@@ 938-947 (lines=10) @@
935
                return [];
936
        }
937
938
        protected function insertStringString($parent, $k, $v, $fn)
939
        {
940
                // The user has passed an element name and an element value:
941
                // [ 'element' => 'Element content' ]
942
943
                $el = $this->createElement($k, $v);
944
                $el = $fn($parent, $el);
945
946
                return [ $el ];
947
        }
948
949
        protected function insertStringMixed($parent, $k, $v, $fn, &$optionals)
950
        {
@@ 949-963 (lines=15) @@
946
                return [ $el ];
947
        }
948
949
        protected function insertStringMixed($parent, $k, $v, $fn, &$optionals)
950
        {
951
                // The user has passed one of these two cases:
952
                // - [ 'element' => [...] ]
953
                // - [ 'element' => DOMNode|SimpleXMLElement|FluidXml ]
954
955
                $el = $this->createElement($k);
956
                $el = $fn($parent, $el);
957
958
                // The new children elements must be created in the order
959
                // they are supplied, so 'appendChild' is the perfect operation.
960
                $this->newContext($el)->appendChild($v, ...$optionals);
961
962
                return [ $el ];
963
        }
964
965
        protected function insertIntegerArray($parent, $k, $v, $fn, &$optionals)
966
        {