Completed
Push — master ( f9ba0c...336b1b )
by Kamil
23:42
created

AdjustmentFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 1
cbo 1
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createNew() 0 4 1
A createWithData() 0 10 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\Order\Factory;
13
14
use Sylius\Component\Resource\Factory\FactoryInterface;
15
16
/**
17
 * @author Mateusz Zalewski <[email protected]>
18
 */
19
class AdjustmentFactory implements AdjustmentFactoryInterface
20
{
21
    /**
22
     * @var FactoryInterface
23
     */
24
    private $adjustmentFactory;
25
26
    /**
27
     * @param FactoryInterface $adjustmentFactory
28
     */
29
    public function __construct(FactoryInterface $adjustmentFactory)
30
    {
31
        $this->adjustmentFactory = $adjustmentFactory;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function createNew()
38
    {
39
        return $this->adjustmentFactory->createNew();
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function createWithData($type, $label, $amount, $neutral)
46
    {
47
        $adjustment = $this->createNew();
48
        $adjustment->setType($type);
49
        $adjustment->setDescription($label);
50
        $adjustment->setAmount($amount);
51
        $adjustment->setNeutral($neutral);
52
53
        return $adjustment;
54
    }
55
}
56