Completed
Push — master ( 620307...8ff95d )
by Dominik
03:16
created

XmlStatusRequest::getData()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 21
Code Lines 12

Duplication

Lines 7
Ratio 33.33 %

Importance

Changes 0
Metric Value
dl 7
loc 21
rs 9.3142
c 0
b 0
f 0
cc 3
eloc 12
nc 3
nop 0
1
<?php
2
/**
3
 * w-vision
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the GNU General Public License version 3 (GPLv3)
8
 * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
9
 * files that are distributed with this source code.
10
 *
11
 * @copyright  Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12
 * @license    GNU General Public License version 3 (GPLv3)
13
 */
14
15
namespace Omnipay\Datatrans\Message;
16
17
/**
18
 * Class XmlStatusRequest
19
 *
20
 * @package Omnipay\Datatrans\Message
21
 */
22
class XmlStatusRequest extends XmlSettlementRequest
23
{
24
    /**
25
     * @var array
26
     */
27
    protected $optionalParameters = [
28
        'reqtype'
29
    ];
30
31
    /**
32
     * @var string
33
     */
34
    protected $apiEndpoint = 'XML_status.jsp';
35
36
    /**
37
     * @var string
38
     */
39
    protected $serviceName = 'statusService';
40
41
    /**
42
     * @return array
43
     */
44
    public function getData()
45
    {
46
        $this->validate('merchantId', 'transactionId', 'sign', 'uppTransactionId');
47
48
        $data = array(
49
            'merchantId'        => $this->getMerchantId(),
50
            'sign'              => $this->getSign(),
51
            'uppTransactionId'  => $this->getUppTransactionId(),
52
            'refno'             => $this->getTransactionId()
53
        );
54
55 View Code Duplication
        foreach ($this->optionalParameters as $param) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
56
            $value = $this->getParameter($param);
57
58
            if ($value) {
59
                $data[$param] = $value;
60
            }
61
        }
62
63
        return $data;
64
    }
65
}
66