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

PlanFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 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\plan;
12
13
/**
14
 * Default plan factory.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class PlanFactory implements PlanFactoryInterface
19
{
20
    /**
21
     * Creates plan object.
22
     * @return Plan
23
     */
24 5
    public function create(PlanCreationDto $dto)
25
    {
26 5
        return new Plan($dto->id, $dto->name, $dto->seller, $dto->prices ?: null);
27
    }
28
}
29