Passed
Push — main ( 0705b8...350a1e )
by Iain
04:41
created

PaymentSection::getSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright Iain Cambridge 2020-2023.
7
 *
8
 * Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license.
9
 *
10
 * Change Date: TBD ( 3 years after 2.2.0 release )
11
 *
12
 * On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file.
13
 */
14
15
namespace Parthenon\Billing\Athena;
16
17
use Parthenon\Athena\AbstractSection;
18
use Parthenon\Athena\ListView;
19
use Parthenon\Athena\Repository\CrudRepositoryInterface;
20
use Parthenon\Athena\Settings;
21
use Parthenon\Billing\Entity\Payment;
22
use Parthenon\Billing\Repository\PaymentRepositoryInterface;
23
24
class PaymentSection extends AbstractSection
25
{
26
    public function __construct(private PaymentRepositoryInterface $paymentRepository)
27
    {
28
    }
29
30
    public function getUrlTag(): string
31
    {
32
        return 'billing-payments';
33
    }
34
35
    public function getRepository(): CrudRepositoryInterface
36
    {
37
        return $this->paymentRepository;
38
    }
39
40
    public function getEntity()
41
    {
42
        return new Payment();
43
    }
44
45
    public function getMenuSection(): string
46
    {
47
        return 'Billing';
48
    }
49
50
    public function getMenuName(): string
51
    {
52
        return 'Payments';
53
    }
54
55
    public function buildListView(ListView $listView): ListView
56
    {
57
        $listView
58
            ->addField('customer', 'entity')
59
            ->addField('provider', 'text')
60
            ->addField('moneyAmount', 'text')
61
            ->addField('completed', 'boolean');
62
63
        return $listView;
64
    }
65
66
    public function getSettings(): Settings
67
    {
68
        return new Settings(['edit' => false, 'create' => false]);
69
    }
70
}
71