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

ProductAttributeValueViewFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 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