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

PlanFactory::create()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

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