Passed
Push — main ( 4a16d4...7ccdec )
by Iain
05:19
created

EntityFactory   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 45
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getPaymentEntity() 0 3 1
A getPriceEntity() 0 3 1
A getSubscriptionEntity() 0 3 1
A getSubscriptionPlanEntity() 0 3 1
A getChargeBackEntity() 0 3 1
A getReceiptLine() 0 3 1
A getReceipt() 0 3 1
A getProductEntity() 0 3 1
A getRefundEntity() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2020-2024 Iain Cambridge
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by
10
 * the Free Software Foundation, either version 2.1 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
namespace Parthenon\Billing\Factory;
23
24
use Parthenon\Billing\Entity\ChargeBack;
25
use Parthenon\Billing\Entity\Payment;
26
use Parthenon\Billing\Entity\Price;
27
use Parthenon\Billing\Entity\PriceInterface;
28
use Parthenon\Billing\Entity\Product;
29
use Parthenon\Billing\Entity\ProductInterface;
30
use Parthenon\Billing\Entity\Receipt;
31
use Parthenon\Billing\Entity\ReceiptInterface;
32
use Parthenon\Billing\Entity\ReceiptLine;
33
use Parthenon\Billing\Entity\ReceiptLineInterface;
34
use Parthenon\Billing\Entity\Refund;
35
use Parthenon\Billing\Entity\Subscription;
36
use Parthenon\Billing\Entity\SubscriptionPlan;
37
use Parthenon\Billing\Entity\SubscriptionPlanInterface;
38
39
class EntityFactory implements EntityFactoryInterface
40
{
41
    public function getSubscriptionEntity(): Subscription
42
    {
43
        return new Subscription();
44
    }
45
46
    public function getPaymentEntity(): Payment
47
    {
48
        return new Payment();
49
    }
50
51
    public function getChargeBackEntity(): ChargeBack
52
    {
53
        return new ChargeBack();
54
    }
55
56
    public function getProductEntity(): ProductInterface
57
    {
58
        return new Product();
59
    }
60
61
    public function getPriceEntity(): PriceInterface
62
    {
63
        return new Price();
64
    }
65
66
    public function getSubscriptionPlanEntity(): SubscriptionPlanInterface
67
    {
68
        return new SubscriptionPlan();
69
    }
70
71
    public function getReceipt(): ReceiptInterface
72
    {
73
        return new Receipt();
74
    }
75
76
    public function getReceiptLine(): ReceiptLineInterface
77
    {
78
        return new ReceiptLine();
79
    }
80
81
    public function getRefundEntity(): Refund
82
    {
83
        return new Refund();
84
    }
85
}
86