Passed
Push — master ( 364662...9798b7 )
by Andrii
02:56
created

BillFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 19
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 2
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\bill;
12
13
/**
14
 * Default bill factory.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class BillFactory implements BillFactoryInterface
19
{
20
    /**
21
     * Creates bill object.
22
     * @return Bill
23
     */
24 2
    public function create(BillCreationDto $dto)
25
    {
26 2
        return new Bill(
27 2
            $dto->id,
28 2
            $dto->type,
29 2
            $dto->time,
30 2
            $dto->sum,
31 2
            $dto->quantity,
32 2
            $dto->customer,
33 2
            $dto->target,
34 2
            $dto->plan,
35 2
            $dto->charges ?: [],
36 2
            $dto->state
37
        );
38
    }
39
}
40