Completed
Push — master ( 6d05bc...71ecc8 )
by Kamil
25:05
created

AddressFactory::createWithCustomer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Core\Factory;
13
14
use Sylius\Component\Core\Model\AddressInterface;
15
use Sylius\Component\Core\Model\CustomerInterface;
16
use Sylius\Component\Resource\Factory\FactoryInterface;
17
18
/**
19
 * @author Anna Walasek <[email protected]>
20
 */
21
class AddressFactory implements AddressFactoryInterface
22
{
23
    /**
24
     * @var FactoryInterface
25
     */
26
    private $decoratedFactory;
27
28
    /**
29
     * @param FactoryInterface $decoratedFactory
30
     */
31
    public function __construct(FactoryInterface $decoratedFactory)
32
    {
33
        $this->decoratedFactory = $decoratedFactory;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function createNew()
40
    {
41
        return $this->decoratedFactory->createNew();
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function createWithCustomer(CustomerInterface $customer)
48
    {
49
        /** @var  AddressInterface $address*/
50
        $address = $this->decoratedFactory->createNew();
51
        $address->setCustomer($customer);
52
        
53
        return $address;
54
    }
55
}
56