Completed
Push — master ( fa9e98...bd4ae6 )
by Dmitry
01:56
created

PriceFactory::createTemplatePrice()   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
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * API for Billing
4
 *
5
 * @link      https://github.com/hiqdev/billing-hiapi
6
 * @package   billing-hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\billing\hiapi\price;
12
13
use hiqdev\php\billing\price\EnumPrice;
14
use hiqdev\php\billing\price\SinglePrice;
15
16
/**
17
 * Class PriceFactory
18
 *
19
 * @author Dmytro Naumenko <[email protected]>
20
 */
21
class PriceFactory extends \hiqdev\php\billing\price\PriceFactory
22
{
23
    protected $creators = [
24
        SinglePrice::class => 'createSinglePrice',
25
        EnumPrice::class => 'createEnumPrice',
26
        TemplatePrice::class => 'createTemplatePrice',
27
    ];
28
29
    public function createTemplatePrice(TemplatePriceDto $dto): TemplatePrice
30
    {
31
        return new TemplatePrice($dto->id, $dto->type, $dto->target, $dto->plan, $dto->prepaid, $dto->price, $dto->subprices);
32
    }
33
}
34