Completed
Push — master ( 5c8cb6...92357d )
by Dmitry
02:05
created

OmnipayRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 34.78 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 8
loc 23
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getWorker() 8 8 2
A getData() 0 8 1

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
 * Generalization over Omnipay and Payum
4
 *
5
 * @link      https://github.com/hiqdev/php-merchant
6
 * @package   php-merchant
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\merchant\yandex;
12
13
/**
14
 * Yandex Omnipay Merchant class.
15
 */
16
class OmnipayRequest extends \hiqdev\php\merchant\OmnipayRequest
17
{
18
    /**
19
     * @return \Omnipay\Common\Message\AbstractRequest
20
     */
21 View Code Duplication
    public function getWorker()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in 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...
22
    {
23
        if ($this->_worker === null) {
24
            $this->_worker = $this->merchant->getWorker()->{$this->getType()}($this->getData());
25
        }
26
27
        return $this->_worker;
28
    }
29
30
    public function getData()
31
    {
32
        return array_merge(parent::getData(), [
33
            'account' => $this->data['purse'],
34
            'form_comment' => $this->data['description'],
35
            'orderId' => $this->data['transactionId'],
36
        ]);
37
    }
38
}
39