Passed
Push — master ( 939904...0d717b )
by Andrii
02:21
created

ChargeFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 1
eloc 9
c 2
b 0
f 1
nc 1
nop 1
dl 0
loc 11
rs 9.9666
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\charge;
12
13
/**
14
 * Default charge factory.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class ChargeFactory implements ChargeFactoryInterface
19
{
20
    /**
21
     * Creates charge object.
22
     * @return Charge
23
     */
24
    public function create(ChargeCreationDto $dto)
25
    {
26
        return new Charge(
27
            $dto->id,
28
            $dto->type,
29
            $dto->target,
30
            $dto->action,
31
            $dto->price,
32
            $dto->usage,
33
            $dto->sum,
34
            $dto->bill
35
        );
36
    }
37
}
38