Completed
Push — master ( 8d10db...a4c05f )
by Łukasz
10s
created

AddressViewFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 14 1
1
<?php
2
3
namespace Sylius\ShopApiPlugin\Factory;
4
5
use Sylius\Component\Core\Model\AddressInterface;
6
use Sylius\ShopApiPlugin\View\AddressView;
7
8
final class AddressViewFactory implements AddressViewFactoryInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function create(AddressInterface $address)
14
    {
15
        $addressView = new AddressView();
16
17
        $addressView->firstName = $address->getFirstName();
18
        $addressView->lastName = $address->getLastName();
19
        $addressView->countryCode = $address->getCountryCode();
20
        $addressView->street = $address->getStreet();
21
        $addressView->city = $address->getCity();
22
        $addressView->postcode = $address->getPostcode();
23
        $addressView->provinceName = $address->getProvinceName();
24
25
        return $addressView;
26
    }
27
}
28