Code Duplication    Length = 14-14 lines in 2 locations

src/Factory/ProductViewFactory.php 1 location

@@ 85-98 (lines=14) @@
82
        return $productView;
83
    }
84
85
    private function getTaxonWithAncestors(TaxonInterface $taxon, $locale): TaxonView
86
    {
87
        $currentTaxonView = $this->taxonViewFactory->create($taxon, $locale);
88
89
        while (null !== $taxon->getParent()) {
90
            $taxon = $taxon->getParent();
91
92
            $taxonView = $this->taxonViewFactory->create($taxon, $locale);
93
            $taxonView->children[] = $currentTaxonView;
94
            $currentTaxonView = $taxonView;
95
        }
96
97
        return $currentTaxonView;
98
    }
99
}
100

src/Factory/TaxonDetailsViewFactory.php 1 location

@@ 33-46 (lines=14) @@
30
        return $detailTaxonView;
31
    }
32
33
    private function getTaxonWithAncestors(TaxonInterface $taxon, string $localeCode): TaxonView
34
    {
35
        $currentTaxonView = $this->taxonViewFactory->create($taxon, $localeCode);
36
37
        while (null !== $taxon->getParent()) {
38
            $taxon = $taxon->getParent();
39
40
            $taxonView = $this->taxonViewFactory->create($taxon, $localeCode);
41
            $taxonView->children[] = $currentTaxonView;
42
            $currentTaxonView = $taxonView;
43
        }
44
45
        return $currentTaxonView;
46
    }
47
48
    private function buildTaxonView(TaxonInterface $taxon, $locale): TaxonView
49
    {