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

BillFactory::create()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 11
nc 1
nop 1
dl 0
loc 13
ccs 12
cts 12
cp 1
crap 2
rs 9.9
c 1
b 0
f 0
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