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

XmlStatusRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 15.91 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 7
loc 44
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getData() 7 21 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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