Completed
Push — master ( 796b11...f7c1ef )
by Dmitry
02:59
created

PlanFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
4
namespace hiqdev\billing\hiapi\repositories;
5
6
use hiqdev\php\billing\Plan;
7
use ReflectionClass;
8
9
class PlanFactory
10
{
11
    protected $class = Plan::class;
12
13
    public function createPrototype()
14
    {
15
        return (new ReflectionClass($this->class))->newInstanceWithoutConstructor();
16
    }
17
18
    public function create(PlanCreationDto $dto)
19
    {
20
        return new Plan($dto->id, $dto->name, $dto->seller, $dto->prices);
21
    }
22
}
23