XmlStatusRequest::getData()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 21
Code Lines 12

Duplication

Lines 7
Ratio 33.33 %

Code Coverage

Tests 12
CRAP Score 3.0261

Importance

Changes 0
Metric Value
dl 7
loc 21
ccs 12
cts 14
cp 0.8571
rs 9.3142
c 0
b 0
f 0
cc 3
eloc 12
nc 3
nop 0
crap 3.0261
1
<?php
2
/**
3
 * w-vision
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the MIT License
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that are distributed with this source code.
10
 *
11
 * @copyright  Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12
 * @license    MIT License
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 = array(
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 2
    public function getData()
45
    {
46 2
        $this->validate('merchantId', 'transactionId', 'sign', 'uppTransactionId');
47
48
        $data = array(
49 2
            'merchantId'        => $this->getMerchantId(),
50 2
            'sign'              => $this->getSign(),
51 2
            'uppTransactionId'  => $this->getUppTransactionId(),
52 2
            'refno'             => $this->getTransactionId()
53 2
        );
54
55 2 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 2
            $value = $this->getParameter($param);
57
58 2
            if ($value) {
59
                $data[$param] = $value;
60
            }
61 2
        }
62
63 2
        return $data;
64
    }
65
}
66