Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function create(TaxonInterface $taxon, string $locale): TaxonView |
||
27 | { |
||
28 | /** @var TaxonTranslationInterface $taxonTranslation */ |
||
29 | $taxonTranslation = $taxon->getTranslation($locale); |
||
30 | |||
31 | /** @var TaxonView $taxonView */ |
||
32 | $taxonView = new $this->taxonViewClass(); |
||
33 | |||
34 | $taxonView->code = $taxon->getCode(); |
||
35 | $taxonView->position = $taxon->getPosition(); |
||
36 | |||
37 | $taxonView->name = $taxonTranslation->getName(); |
||
38 | $taxonView->slug = $taxonTranslation->getSlug(); |
||
39 | $taxonView->description = $taxonTranslation->getDescription(); |
||
40 | |||
41 | /** @var ImageInterface $image */ |
||
42 | foreach ($taxon->getImages() as $image) { |
||
43 | $taxonView->images[] = $this->imageViewFactory->create($image); |
||
44 | } |
||
45 | |||
46 | return $taxonView; |
||
47 | } |
||
48 | } |
||
49 |