Completed
Pull Request — master (#123)
by Łukasz
02:59
created

ProductAttributeValueViewFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace Sylius\ShopApiPlugin\Factory;
4
5
use Sylius\Component\Product\Model\ProductAttributeValueInterface;
6
use Sylius\ShopApiPlugin\View\ProductAttributeValueView;
7
8
final class ProductAttributeValueViewFactory implements ProductAttributeValueViewFactoryInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function create(ProductAttributeValueInterface $productAttributeValue)
14
    {
15
        $productAttributeValueView = new ProductAttributeValueView();
16
17
        $productAttributeValueView->code = $productAttributeValue->getCode();
18
        $productAttributeValueView->name = $productAttributeValue->getName();
19
        $productAttributeValueView->value = $productAttributeValue->getValue();
20
21
        return $productAttributeValueView;
22
    }
23
}
24