Completed
Pull Request — master (#4)
by Andrey
11:13 queued 07:59
created

AbstractAuthorizeOrderConverter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 29
loc 29
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 3 3 1
A setBody() 7 7 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
/**
4
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Amazonpay\Business\Api\Converter;
9
10
use Generated\Shared\Transfer\AmazonpayResponseTransfer;
11
use PayWithAmazon\ResponseInterface;
12
13 View Code Duplication
abstract class AbstractAuthorizeOrderConverter extends AbstractResponseParserConverter
0 ignored issues
show
Duplication introduced by
This class 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...
14
{
15
16
    /**
17
     * @var \SprykerEco\Zed\Amazonpay\Business\Api\Converter\ArrayConverterInterface $authDetailsConverter
18
     */
19
    protected $authDetailsConverter;
20
21
    /**
22
     * @param \SprykerEco\Zed\Amazonpay\Business\Api\Converter\ArrayConverterInterface $authDetailsConverter
23
     */
24
    public function __construct(ArrayConverterInterface $authDetailsConverter)
25
    {
26
        $this->authDetailsConverter = $authDetailsConverter;
27
    }
28
29
    /**
30
     * @param \Generated\Shared\Transfer\AmazonpayResponseTransfer $responseTransfer
31
     * @param \PayWithAmazon\ResponseInterface $responseParser
32
     *
33
     * @return \Generated\Shared\Transfer\AmazonpayResponseTransfer
34
     */
35
    protected function setBody(AmazonpayResponseTransfer $responseTransfer, ResponseInterface $responseParser)
36
    {
37
        $responseTransfer->setAuthorizationDetails(
38
            $this->authDetailsConverter->convert($this->extractResult($responseParser)['AuthorizationDetails'])
39
        );
40
41
        return parent::setBody($responseTransfer, $responseParser);
42
    }
43
44
}
45