Completed
Push — master ( b4c2b2...50fde4 )
by Torben
86:18 queued 41:18
created

ItemsProcFunc::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace DERHANSEN\SfEventMgt\Hooks;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
use DERHANSEN\SfEventMgt\Service\PaymentService;
19
20
/**
21
 * Hooks for ItemsProcFunc
22
 *
23
 * @author Torben Hansen <[email protected]>
24
 */
25
class ItemsProcFunc
26
{
27
28
    /**
29
     * @var PaymentService
30
     */
31
    protected $paymentService;
32
33
    /**
34
     * ItemsProcFunc constructor.
35
     */
36
    public function __construct()
37
    {
38
        $this->paymentService = GeneralUtility::makeInstance(PaymentService::class);
39
    }
40
41
    /**
42
     * Itemsproc function for payment method select field
43
     *
44
     * @param array $config
45
     */
46
    public function getPaymentMethods(array &$config)
47
    {
48
        $paymentMethods = $this->paymentService->getPaymentMethods();
49
        foreach ($paymentMethods as $value => $label) {
50
            array_push($config['items'], [$label, $value]);
51
        }
52
    }
53
54
}
55