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

ChargeFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 10
c 2
b 0
f 1
dl 0
loc 17
rs 10
wmc 1

1 Method

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