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

PlanFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 14
ccs 0
cts 3
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createPrototype() 0 4 1
A create() 0 4 1
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