Code Duplication    Length = 15-15 lines in 2 locations

module/Core/src/Core/Factory/Form/Tree/SelectFactory.php 1 location

@@ 182-196 (lines=15) @@
179
     * @return string item value prepended with all parent values except root node.
180
     * @todo This code is currently duplicated in \Core\Form\Tree\Select.
181
     */
182
    private function getItemValue(NodeInterface $item)
183
    {
184
        $parts = [ $item->getValue() ];
185
186
        while ($item = $item->getParent()) {
187
            $parts[] = $item->getValue();
188
        }
189
190
        array_pop($parts); // No root node.
191
192
        $parts = array_reverse($parts);
193
        $value = join('-', $parts);
194
195
        return $value;
196
    }
197
}

module/Core/src/Core/Form/Hydrator/Strategy/TreeSelectStrategy.php 1 location

@@ 176-190 (lines=15) @@
173
     *
174
     * @return string item value prepended with all parent values except root node.
175
     */
176
    private function getItemValue(NodeInterface $item)
177
    {
178
        $parts = [ $item->getValue() ];
179
180
        while ($item = $item->getParent()) {
181
            $parts[] = $item->getValue();
182
        }
183
184
        array_pop($parts); // No root node.
185
186
        $parts = array_reverse($parts);
187
        $value = join('-', $parts);
188
189
        return $value;
190
    }
191
192
    /**
193
     * Find a leaf with a concrete value in the tree.